ASMB,A,B,L,C        2000/E LOADER/UTILITY PROGRAM 
*                                      RELEASE A    12/15/72
*                                      RELEASE B     4/15/73
*                                      RELEASE C    11/14/74
*                                      RELEASE D     8/20/75
* 
* 
*     (C) COPYRIGHT HEWLETT-PACKARD COMPANY 1975. 
* 
*     ALL RIGHTS RESERVED.  NO PART OF THIS PROGRAM 
*     MAY BE PHOTOCOPIED, REPRODUCED, OR TRANSLATED 
*     TO ANOTHER PROGRAM LANGUAGE WITHOUT THE PRIOR 
*     WRITTEN CONSENT OF HEWLETT-PACKARD COMPANY. 
* 
      ORG 4 
      SUP          SUPPRESS EXTRA PRINTING
      HLT 4,C      LOADER POWER FAIL HALT 
A     EQU 0 
B     EQU 1 
      SPC 2 
* 
*         EQUIPMENT TABLE 
* 
      ORG 100B
DIREC BSS 56       DIRECTORY TRACK HEADERS
      BSS 1 
IDTTA DEF IDLOC 
IDLOC BSS 4 
IDTRL DEF IDLEN 
IDLEN BSS 4 
ADLOC BSS 1        ADT DISC ADDRESS 
ADLEN BSS 1        ADT LENGTH IN -WORDS 
DTBL  BSS 1 
NPORT BSS 1        -NUMBER OF AVAILABLE PORTS 
PHNSC BSS 1        PHONES SELECT CODE 
FILLR BSS 1         DELAY COUNT                  [D]
SLEPT BSS 1    0=SLEPT   -1=NOT SLEPT 
IDTRA EQU 72B 
IDTLA EQU 73B 
      ORG 2000B 
      JMP *+1,I 
      DEF MAIN
      HED * POST-SLEEP DISC LOADER *
* 
***   THIS LOADER IS DISC RESIDENT ON TRACK 0 SECTORS 1,2,3 
**    IT IS USED TO BRING UP A SLEPT SYSTEM FROM DISC 
* 
      ORG 2002B 
BSLDR CLA           CLEAR ALL DEVICES.
      CLC 0,C 
      CLC 0,C 
      ISZ A 
      JMP *-3 
      LDA BPWL     READ 
      STA WORDC    BASE PAGE
      LDA D.12      SEGMENT 
      LDB B$15     FROM DISC
      JSB DISCD 
* *q
      LDA BSYS1    READ 
      STA WORDC    BASIC
      LDB RSYS1    SEGMENT # 1
      LDA LDRTT    FROM 
      JSB DISCD    DISC 
* 
      LDA BSYS2    READ 
      STA WORDC    BASIC
      LDB RSYS2    SEGMENT # 2
      LDA LDRTT+1  FROM 
      JSB DISCD    DISC 
* 
* *q
      LDA LDRLN     READ
      STA WORDC    LOADER 
      LDA LDRTK    SEGMENT
      LDB RSYS0    FROM 
      JSB DISCD    DISC 
BSLD1 LDA SLEPT     IF FLAG=0,
      SSA,RSS                                   (D) 
      JMP DATEP,I  GET DATE AND TIME
      LDA .+18      OTHERWISE OUTPUT MESSAGE
      LDB SLMSP       AND 
      JSB TTY35         HALT. 
      LDA SLEPT 
      HLT T	
      SSA                                       (D) 
      JMP BSLD1+3   LOOP                        (D) 
      ISZ SLEPT     SHOW ALTERATION             (D) 
      JMP DATEP,I   AND START UP                (D) 
* 
* 
* 
LDRTT BSS 4 
LDRLN ABS 4000B-EOL 
DC    EQU 11B 
CC    EQU 12B 
D.377 OCT 377 
D.77  OCT 77
HEAD1 OCT 400 
HEAD2 OCT 1000
D.10  DEC -10 0u
M.128 DEC -128
M24   DEC -24 
TRK#  NOP 
DADDR NOP 
CORE  NOP 
HD/SC NOP 
FAIL  NOP 
WORDC NOP 
DMACW ABS 120000B+DCD{
SEEK  OCT 030000
READ. OCT 020000
WRITE OCT 010000
* q{
B$15  OCT 100000
BSYS1 DEC -6144 4a
BSYS2 DEC -6144 
M.1   EQU 14000B+6144 
RSYS1 DEF SSYST,I 
RSYS2 DEF M.1,I IX
RSYS0 OCT 104000
LDRTK NOP           FILLED AT SYS GENERATION
DATEP DEF LDR72 
BPWL  DEC -1024 
D.12  OCT 114 
DRIVE NOP Px
DB100 OCT 100 
      HED * ASR35 DRIVER *
* 
*     UPON ENTRY (A) HOLDS THE NUMBER OF CHARACTERS TO BE 
*     OUTPUT OR IS ZERO TO REQUEST INPUT. FOR OUTPUT REQUESTS 
*     (B) POINTS TO THE FIRST WORD OF THE BUFFER. A LINE-FEED,
*     RUBOUT, NULL, OR X-OFF IS IGNORED BY INPUT. ON INPUT
*     A CARRIAGE RETURN ENDS THE RECORD, A _ BACKSPACES ONE 
*     CHARACTER, AND A CONTROL X DELETES THE
*     INPUT RECORD. 
* 
TTY35 NOP 
      STA CCNTY    SET CARACTER COUNT 
      SZA,RSS      OUTPUT REQUEST?
      JMP TTY6     NO 
      BLS          YES, INITIALIZE
      STB BUFAD    CARACTER POINTER 
      CCA          SET FLAG 
      STA TFLAG    AS 'OUTPUT'
      LDA B120K    SEND BITS FOR
      OTA TTYSC     'PRINT ONLY'
TTY1  LDA CCNTY    ALL CHARACTERS 
      SZA,RSS      OUTPUT?
      JMP TTY35,I  YES
      ADA NM1      NO, CORRECT
      STA CCNTY    CHARACTER COUNT
      LDB BUFAD    COMPUTE
      ISZ BUFAD    WORD-CHARACTER 
      CLE,ERB      ADDRESS
      LDA 1,I      LOAD WORD
      SEZ,RSS      POSITION 
      ALF,ALF      CHARACTER
      AND DB177    EXTRACT CHARACTER
      IOR NB200    ADD IN BIT 7 
      OTA TTYSC    OUTPUT IT
TTY2  STC TTYSC,C  REQUEST CHARACTER TRANSFER 
      SFS TTYSC    WAIT FOR 
      JMP *-1      COMPLETION FLAG
      LDB TFLAG                                 (D) 
      SZB,RSS      OUTPUT                       (D) 
      JMP TTY7     NO                           (D) 
      LDB FILCT    YES, PRINTING FILL CHAR?     (D) 
      ISZ FILCT    FILLING DONE OR TTY CONSOLE  (D) 
      SSB,RSS      NONE OF THE ABOVE            (D) 
      JMP *+3      FILCT IS POSITIVE            (D) 
      LDA DB177    PRINTING FILLS, GET ONE      (D) 
      JMP TTY2-2   AND OUTPUT IT                (D) 
      LDB FILLC     JUST IN CASE                (D) 
      CPA LFEED    A LINE FEED WAS PRINTED      (D) 
      STB FILCT    IT WAS, SET FILL FLAG        (D) 
      JMP TTY1     AND CONTINUE                 (D) 
* 
TTY7  LIA TTYSC    EXTRACT CHARACTER            (D) 
      AND DB177    CHARACTER
      CPA DB12     LINE FEED? 
      JMP TTY2     YES
      CPA DB177    NO, RUBOUT?
      JMP TTY2     YES
      SZA          NO, NULL 
      CPA NB23     OR X-OFF 
      JMP TTY2     YES
      CPA BKSPC    NO, '_'? 
      JMP TTY4     YES
      CCB          NO 
      CPA DB30       EXIT ON CONTROL X
      JMP TTY5
      STA TTYTM    SAVE CHARACTER 
      LDB CCNTY    BACKSPACE
      CPB D.72     IF BUFFER
      JSB BKSP     IS FULL
      LDB BUFAD    COMPUTE
      ISZ BUFAD    NEXT BUFFER
      CLE,ERB      ADDRESS
      SEZ,RSS      POSITION 
      ALF,SLA,ALF  AND FORM 
      IOR 1,I      BUFFER WORD
      STA 1,I      STORE AND
      ISZ CCNTY    COUNT CHARACTER
      LDA TTYTM    WAS IT A 
      CPA NB15     CARRIAGE RETURN? 
      JMP TTY35,I  YES
      JMP TTY2     NO 
TTY4  JSB BKSP     BACKSPACE
      JMP TTY2YO
TTY5  STB TFLAG    SET TO OUTPUT
      ADB TTY35    SET RETURN 
      STB TTY35    TO INPUT CALL
      LDA N.3      OUTPUT '\' AND 
      LDB RVRSA    CARRIAGE RETURN- 
      JMP TTY35+1  LINE FEED
TTY6  LDB IBUFA    SET UP INPUT 
      STB BADRA,I  BUFFER R(
      STB BUFAD    POINTERS 
      STA TFLAG    SET TO INPUT MODE
      LDA B160K    SEND INPUT BITS
      JMP TTY2-1   TO ASR 35
* *q
**    BACKSPACE ON CHARACTER  **
* 
BKSP  NOP 
      LDB CCNTY    DECREMENT
      SZB,RSS      CHARACTER
      JMP BKSP,I   COUNT
      ADB NM1      IF 
      STB CCNTY    NON-ZERO 
      CCB          BACKSPACE
      ADB BUFAD    CHARACTER
      STB BUFAD    ADDRESS
      CLE,ERB      INSURE 
      LDA 1,I      NEXT CHARACTER 
      AND HIMSK    WILL NOT BE
      STA 1,I      GARBLED
      LDA TTYTM    RETRIEVE CHARACTER FOR CALLS 
      JMP BKSP,I   FROM BUFFER OVERFLOW 
NM1   DEC -1
N.3   DEC 3 
DB12  OCT 12
NB15  OCT 15
NB23  OCT 23
DB30  OCT 30
D.72  DEC 72
DB177 OCT 177 7`
NB200 OCT 200 
LFEED OCT 212                                   (D) 
FILCT DEC -1        ASSUME ASR35 SYSTEM CONSOLE (D) 
FILLC DEC -1                                    (D) 
BKSPC OCT 137 
B120K OCT 120000   'PRINT ONLY' TTY CONTROL BITS
B160K OCT 160000   'INPUT' TTY CONTROL BITS 
HIMSK OCT 177400
RVRSL OCT 56015,5000  '\ CR-LF' FOR LINE DELETION 
TTYSC EQU 10B 
CCNTY BSS 1 
INBUF BSS 36       TTY INPUT BUFFER 
BUFAD BSS 1        TTY CHARACTER ADDRESS
TFLAG BSS 1        TTY I/O MODE 
TTYTM BSS 1        TTY TEMPORARY
IBUFA ABS INBUF+INBUF 
RVRSA DEF RVRSL 
BADRA DEF BADDR 
ILIN  OCT 5111
      ASC 6,LLEGAL INPUT
      OCT 6400
SLMSP DEF *+1 
      OCT 6412      CR-LF 
      ASC 7,SYS NOT SLEPT 
      OCT 6412      CR-LF 
      HED * DISC DRIVER * 
*     UPON ENTRY (A) HOLDS THE DISC ADDRESS ON THE
*     SYSTEM DISC (HEAD 2 ASSUMED BY DRIVER). (B) HOLDS 
*     THE CORE ADDRESS. BIT 15 OF (B) IS 1 FOR
*     A TRANSFER TO CORE, 0 FOR A TRANSFER TO DISC. 
*     'WORDC' IS SET TO THE NEGATIVE TRANSFER LENGTH
*     IN WORDS. 
* 
DISCD NOP 
      STA DADDR    SAVE DISC AND
      STB CORE     CORE ADDRESSES 
      LDA WORDC    EXIT ON
      SZA,RSS      WORD COUNT 
      JMP DISCD,I  OF ZERO
      SSB,RSS      ROUND UP 
      AND M.128    TO FULL SECTOR 
      STA WORDC    ON WRITE 
      LDA DADDR 
      AND B$15      GET DRIVE NUMBER
      RAL 
      STA DRIVE 
      LDA DADDR 
      LSR 7        GET
      AND D.377    CYLINDER NUMBER
      STA TRK#     SAVE TRACK NUMBER
      LDA DADDR    ISOLATE SECTOR 
      AND D.777
      STA HD/SC     SAVE SECTOR # 
      ADA M24       > 24? ?z
      SSA,RSS 
      ADA HEAD1     YES - HEAD 1 OR HEAD 3
      SSA,RSS 
      STA HD/SC     IF >24 SAVE NEW SECTOR #
      LDA DADDR     GET FIXED DISC BIT
      AND DB100 
      LDB HD/SC     LOAD HEAD AND SECTOR
      SZA 
      ADB HEAD2       ADD HEAD 2 BIT
      STB HD/SC     SAVE HEAD/SECTOR ADDRESS
      LDB D.10     SET RETRY COUNTER
      STB FAIL     FOR 10 TRIES 
      LDA TRK#     OUTPUT TRACK NUMBER
.DDR1 OTA DC       FOR SEEK OPERATION 
      STC DC,C
      LDA SEEK
      IOR DRIVE 
      CLC CC       CLEAR PREVIOUS COMMAND 
      OTA CC        OUTPUT SEEK COMMAND 
      STC CC,C     TO COMMAND CHANNEL 
      SFS DCD+
      JMP *-1 
      LDA HD/SC 
      OTA DC        OUTPUT HEAD/SECTOR
      STC DC,C     TO DATA CHANNEL
      SFS CC       WAIT FOR 
      JMP *-1      SEEK RECORD COMPLETE 
      LDA DMACW 
      OTA 6        OUTPUT DMA CONTROL WORD
      CLC 2 II
      LDB CORE     OUTPUT BUFFER ADDRESS
      OTB 2 
      STC 2 
      LDB WORDC    OUTPUT WORD COUNT
      OTB 2 
      JSB STAT     CHECK STATUS 
      LDA READ.    (A) = READ COMMAND 
      LDB CORE     READ OPERATION REQUESTED?
      SSB,RSS 
      LDA WRITE    NO: (A) = WRITE COMMAND
      IOR DRIVE 
      CLC CCCF
      OTA CC       OUTPUT READ/WRITE COMMAND
      SSB,RSS      IF OUTPUT, PRESET
      STF DC       DATA CHANNEL FLAG
      SSB          IF INPUT, CLEAR
      STC DC,C     THE FLAG AND SET CONTROL 
      STC 6,C      START DMA
      STC CC,C     START READ/WRITE OPERATION 
      SFS CC       WAIT FOR READ/WRITE
      JMP *-1      TO COMPLETE
      STF 6         TURN OFF DMA
      JSB STAT     CHECK STATUS 
      CLC DC
      CLC CCCF
      CLC 6,C 
      JMP DISCD,I  RETURN 
* 
***   CHECK DISC STATUS 
* *q
STAT  NOP 
      STC DC,C      SET TO CHECK DRIVE 0
      CLA          SET TO CHECK DRIVE 0 
      IOR DRIVE 
      OTA CC       OUTPUT STATUS COMMAND
      CLC CC
      STC CC,C     TO COMMAND CHANNEL 
      SFS DC
      JMP *-1 
      LIA DC       GET DISC STATUS
      CLC DC
      SLA,RSS      ANY ERRORS?
      JMP STAT,I   NO 
      ISZ FAIL     TRIED 10 TIMES?
      JMP .DDR1-1  NO TRY AGAIN 
DRV1  EQU * 
      HLT 11B      YES - IRRECOVERABLE ERROR
      JMP *-1 
      JMP DNTRA,I     FOR INITIALIZATION
DNTRA DEF DINTR 
      SPC 5 UU
* 
***   NON-SLEEP RELOAD ENTRY POINT
* 
      ORG 3000B 
      CLB           CLEAR 
      CLC 0,C         ALL 
      ISZ 1         DEVICES 
      JMP *-2 
      JSB CLD,I     CLEAR DISCS 
      JMP *+1,I 
      DEF LDR6
CLD   DEF CLDSC 
* qqq{
**   DISC STATUS ROUTINE
* 
DISST NOP P4
      CLC DC
      CLC CCFF
      STC DC,C,O
      CLA 
      IOR SDRIV 
      OTA CC
      STC CC,C
      SFS DC
      JMP *-1 
      LIA DC
      CLC DC
      CLC CC
      SLA,RSS 
      JMP DISST,I       NO ERRORS 
      STA SDST          SAVE STATUS 
      XOR FSEEK         FIRST SEEK? 
      SZA,RSS 
      JMP DISST,I       YES 
      LDA SDST          NO - SOMETHING ELSE IS WRONG
      LSR 6 
      SLA,RSS           IS DISC READY?
      JMP DISST,I       YES 
      LDA .+15
      LDB DBUSA 
      JSB TTY35          DISC IS NOT READY
      JMP CONTR,I 
CONTR DEF INCOM 
DBUSA DEF *+1 
      OCT 5104
      ASC 7,ISC NOT READY 
FSEEK OCT 40001 
SDST  OCT 0 
SDRIV  OCT 0
* qq
*     BUFFER FOR TRACKS 
* 
TRKTB BSS 36
      HED MAG TAPE DRIVER 
CMND  EQU 0 
DATA  EQU 0 
XMTD  NOP 
      STA BUFL      SAVE BUFFER ADDRESS 
      STB BUFA        AND LENGTH
MTDM1 EQU * 
      JSB XSTIN     GET STATUS
      SLA           CONTROLLER BUSY?
      JMP XS.1      YES, CONTINUE 
XT.13 CLC DATA      CLEAR CONTROL BIT 
XT.16 CLC CMND      - ON BOTH CHANNELS
      LDA SL0       NO
XT.1  OTA CMND      SELECT UNIT # 
      JSB XATCK     INSURE TAPE UNIT IN ATUO
      LDA XMTD,I     FETCH OPERATION CODE 
      AND DB7       USE LOAWER 3 BITS 
      CPA DB7       STATUS REQUEST? 
      JMP ERR.1     YES, STATUS IN B
      STA XABS      NO
      LDA DB110     ISSUE CLEAR 
      JSB XCMND       COMMAND 
      LDA XABS
      ISZ XMTD       RETURN POINT 
      ADA XBASE     LOOK UP PROCESSOR IN TABLE
      JMP 0,I       CALL PROCESSOR
* qq
XBASE DEF *+1,I     COMMAND PROCESSOR ENTRY 
      DEF XREAD       POINT TABLE 
      DEF XWRTE 
      DEF XWEOF 
      DEF XREW
      DEF XPOS
      DEF XRES
      DEF XGAP
      SPC 5 5U
XRES  LDA DB105     REWIND/STANDBY
      CCE,RSS 
XREW  LDA DB101     REWIND COMMAND
      CCE 
      JSB XCMND     INITIATE COMMAND EXECUTION
      JSB XSTIN     GET STATUS
      JMP XIT1
* 
** TAPE POSITIONING ROUTINE 
* 
* ENTR WITH COMMADNS STORED IN BUFA AND BUFL
* 
XPOS  LDB BUFL      GET FILE COUNT
      LDA DB200 
      JSB XABS      SET FLAGS, COMMANDS AND OUNT
      JMP XP.1      # FILES = 0 DO RECORES
XP.5  CCA,SEZ,CCE,RSS 
      JSB XP.2      BACK WARDS MOTION 
      JSB XSPCE     FORWARD SPACE 
      JMP XP.5      REAEAT UNTIL FILE 
      ISZ XCNTR     FINISHED? 
      JMP XP.5      NO, LOOP
      LDA BUFL
      RAL,CLE,SLA,ELA 
      ISZ BUFA
      SLA,ARS       SKIP
      JMP XIT 
XP.1  LDB BUFA      PROCESS RECORDS 
      CLA 
      JSB XABS      SET FOR FWD/REV RECORD SPACING
      JMP XIT       NO RECORD, EXIT 
XP.0  CCA,SEZ,CLE,RSS 
      JSB XP.2      YES, GO CHECK FOR "BOT" 
      JSB XSPCE     FORWARD SPACE 
SL0   ALR           SELECT UNIT 0 COMMAND 
      ISZ XCNTR     FINISHED? 
      JMP XP.0      NO, LOOP
* qq
XIT   ISZ XMTD
      JSB XSTIN     GO LOAD THE MT STATUE 
ERR.1 ISZ XMTD
XIT1  LDA BUFL
XT.4  CLC CMND      CLEAR MT COMMAND CONTROL BIT
      JMP XMTD,I
XP.2  NOP 
      JSB XSTIN     GET STATUS
      RAL 
      SSA,RSS       MT UNIT AT SOT? 
      JMP XP.2,I    NO, RETURN
      SEZ           YES, FILE SKIPPING" 
      ISZ XCNTR     CNT=-1? 
      JMP XIT1      NO, TRIED TO CORSS SOT
      JMP XP.1      YES, DO RECORD SPACING
      SPC 3 hh
XABS  NOP           SET UP ROUTINE
      SSB,RSS 
      ADA .+3       FORWARD SPACE COMMAND 
      SSB IF # IS . 0 SET FOR 
      ADA DB41        BACKSPACE COMMAND 
      STA XWNEC 
      CLE,SSB,RSS   GET -ABS(#) FOR CNT 
      CMB,CCE,INB,SZB  IS THE MT TO BE MOVED? 
      ISZ XABS      YES, EXIT TO P+2
      STB XCNTR 
      JMP XABS,I
XSPCE NOP 
      CLE,SSA       IS TAPE MOTION BACKWARDS
      JSB XEOTC 
      LDA XWNEC 
      JSB XCMND     SPACE 
      RAL,SLA       EOF MARK? 
      ISZ XSPCE     YES 
      CCE,SSA       NO, IS THE TAPE AT SOT? 
      JMP XIT1      YES 
      JMP XSPCE,I   NOPE
XSTIN NOP           GET TAPE STATUS 
XS.1  LIA CMND
      LDB 0         (B)=STATUS
      ALF,ALF       (A)= STATUS SHIFTED 8 BITS
      JMP XSTIN,I 
* 
** WRITE 4" BLANK TAPE
* 
XGAP  JSB XWNEC     CHECK FOR WRITE RING
      JSB XEOTC     CHECK FOR END OF TAPE 
      LDA DB15      COMMAND 
      JSB XCMND 
      JMP XIT 
* qq
**  WRITE END OF FILE 
* 
XWEOR LDA DB41      BACKSPACE RECORD COMMANDP 
      JSB XCMND     EXECUTE COMMAND 
      JMP RWEOF 
XWEOF JSB XWNEC     CHECK FOR WRITE 
XT.12 CLF DATA
RWEOF LDA DB215     WRITE FILE MARK CODE
      JSB XCMND 
      RBR,SLB,RBL   PARITY OR TIMING ERROR CO OCCUR 
      JMP XWEOR     YES, GO BACKSPACE 
      JSB XEOTC     NO
      JMP XIT II
      SPC 3 
XWRTE JSB XWNEC     CHECK FOR WRITE ENABLED 
      JSB XEOTC     CHECK FOR END OF TAPE 
      JSB XCNTR     GET NEG # WORDS 
      ADA .-1       ADD 1 FOR RECORD LENGTH 
      STA XWNEC     SAVE WORD COUNT 
      LDA DB31      WRITE RECORD COMMEND
      JSB XCMND     GO INTIATE WRITE SEQUENCE 
XT.9  STC DATA,C    INITIALIZE DATA CHANNEL 
      ADB BUFA      BUFFER ADDRESS - 1
      LDA BUFL      FIRST WRITTEN WORD IS BUFL
XOUT  INB           STEP BUFFER POINTER 
XT.20 SFC CMND
      JMP XT.5
XT.2  SFS DATA      WAIT FOR
      JMP XT.20       DATA FLAG 
XT.3  OTA DATA,C    WRITE RECORD HEADER WORD
      LDA 1,I       GET NEXT WORD 
      ISZ XWNEC     DONE
      JMP XOUT      NO, LOOP
XT.5  CLC DATA      INITIATE END OF RECORD SEQUENCE 
XT.10 SFS CMND      WRITE COMPLETE? 
      JMP XT.10     NO, CONTINUE
      JSB XSTIN     YES, GET STATUS 
      RBR,SLB       PARITY OR TIMING ERROR? 
      CLE,RSS       YES 
      JMP XIT       NO
      LDA DB41      BACKSPACE 
      JSB XCMND 
      LDA DB15
      JSB XCMND     GAP 
      JMP XEOTC+1   RETRY 
      SPC 3 3h
XREAD JSB XEOTC     READ
      LDA DM3       SET RETRY 
      STA XSPCE       COUNTER TO -3 
      JSB XCNTR     GET NEG # OF WORDS
      STA XCNTR 
XRERD CCA,CCE 
      ADA BUFA      BUFFER ADDRESS -1 
      STA XWNEC 
      CLA 
      STA XABS      INITIALZE RECORD LENGTH COUNTER 
      LDA DB23      REA D CHARACTERS CODE 
      JSB XCMND     INITIATE READ RECORD SEQUENCE 
XT.11 STC DATA,C    INITIALIZE DATA CHANNEL 
      LDB XCNTR     LOAD NEG WORD COUNT 
      JSB XWAIT     WAIT FOR 1ST WORD 
      STA XABS      SAVE RECOTD LENGTH
      JSB XWAIT     WAIT FOR NEXD OR EOR
      ISZ XWNEC     STEP BUFFER POINTER 
      STA XWNEC,I   ***  THIS WORD CHENGED  *** 
      INB,SZB,RSS   END OF BUFFER?
      RSS           END OF BUFFER OR NO COMPARE 
      JMP XLOOP 
      SZB           END OF BUFFER 
      JMP MTDER     NO, NO COMPARE
XT.50 CLC DATA      YES, START EOR SEQUENCE 
XT.8  SFS CMND      READ FUNTION COMPLETE?
      JMP XT.8      NO
      JSB XSTIN     YES, RESTORE STATUS 
      SSA           WAS NA =EOF" READ?
      JMP XIT1      YES, RETURN TO P+2
      RBR,SLB,RBL   PARITY OR TIMING ERROR
      RSS           YES 
      JMP XENDR     NO
NOISE ISZ XSPCE     HAVE WE TRIED 3 TIMES?
      CLE,RSS       NO
      JMP XSHRT     YES 
      LDA DB41      BACKSPACE 
      JSB XCMND 
      JMP XRERD     TRY AGAIN 
XSHRT LDA BUFA      RECORD
      CMA,INA &&
      ADA XWNEC       < 5 
      ADA DM5 
      SSA               WORDS?
      JMP XREAD     YES 
      JMP ERR.1     NO
* qq
*     RECORD < BUFFER LENGTH, GET TAPE LENTGTH IN USER'S BUFFER **
XENDR LDA XABS      GET TAPE RECORD LENGTH
      SZA,RSS        IS LENGTH ZERO?
      JMP NOISE     YES, ASSUME TAPE NOISE
      LDB BUFL      GET UER BUFFER LENGTH 
      STB BUFA      SAVE USER REQUEST 
      SSA 
      JMP XEND2 2
      SSB 
      ARS 
      JMP XEND1 
* qqq{
XEND2 SSB,RSS 
      ALS 
      CMA,INA 
XEND1 STA BUFL      SAVE TAPE LEGTH FOR USER
      SSB,RSS       USER LENGTH 
      CMB,INB       YES 
      ADA 1         NO
      CMB,INB 
      SSA,RSS       RECORD LENGTH > USER REQUEST? 
      STB BUFL      YES, STORE USER REQUEST LENGTH
      LDA BUFL
      LDB BUFA      GET ORIGINAL REQUEST
      SSB 
      CMA,INA        YES, NEGATE ACTUAL LENGTH
      STA BUFL      NO
      JMP XIT       CONTINUE READ PROCESSING
      SPC 3 
XWAIT NOP 
XLOOP SFC CMND       END OF RECORD? 
      JMP XT.50     YES 
XT.46 SFS DATA      NO, NEXT WORD READY?
      JMP XLOOP     NOP 
XT.43 LIA DATA,C    YES, LOAD DATA WORD 
      JMP XWAIT,I 
      SPC 3 
XCNTR NOP 
      LDA BUFL      USER'S BUFFER LENGTH
      CCE,SSA       WORDS?
      JMP XCNTR,I   YES 
      CMA,INA,SZA,RSS 
      JMP XIT       DONE IF REQUEST =0
      ARS 
      JMP XCNTR,I 
      SPC 3 
XWNEC NOP 
      JSB XSTIN     GET STATUS
      RAR,SLA        UNIT READY?
      JMP XS.1      NO
      RBR,CLE,RBR   YES 
      SLB,RSS       WRITE ENABLED?
      JMP XWNEC,I      YES
      LDA .+19       NO 
      LDB WNEA      OUTPUT
      JSB TTY35        MESSAGE
      HLT 33B       HALT
      JSB XATCK     CHECK FOR AUTO
      JMP XWNEC+1 
      SPC 3 
XCMND NOP ii
XT.14 OTA CMND      OUTPUT COMMAND
XS.0  LIB CMND      LOAD STATUS WORD
      RBR,RBR 
      RBR,SLB       REQUEST REJECTED
      JMP REJCT     YES 
XT.7  STC CMND,C     NO INITIATE EXECUTION
      CCB,SEZ,CLE   READ OR WRITE?
      JMP XCMND,I   YES, RETURN 
XT.15 SFS CMND
      JMP XT.15 
      JSB XSTIN     GET STATUS
      JMP XCMND,I 
* 
** CHECK FOR TAPE UNTI IN AUTO
* 
XATCK NOP P%
      JSB XSTIN     GET STATUS
      CLE,SLB,RSS   UNIT IN AUTO? 
      JMP XATCK,I   YES 
      LDA .+25       OUTPUT 
      LDB MTLMA 
      JSB TTY35 
      HLT 44B       HALTLH
      JMP XATCK+1 
      SPC 3 
REJCT LDB DB110     LOAD CLEAR COMMAND
O.B   OTB CMND      OUTPUT IT 
XT.6  STC CMND,C     INITIATE IT
XT.0  SFS CMND      COMPLETED?
      JMP XT.0      NO
      JMP XT.14     YES 
      SPC 3 3h
XEOTC NOP Pi
      JSB XSTIN     GET STATUS
      ALF,CLE,RAR   SHIFT "EOT" TO A0 
      SLA           AT "EOT?
      JMP XIT1      YES 
      JMP XEOTC,I   NOPE
* *q
      SKP 
* 
*     MAG TAPE DRIVER CONFIGUARTION 
*     ENTER WITH THE LOAWER MAG TPAE SELECT COEE IN B 
* qq
MTDIN NOP 
      STA MTSCD       SAVE SELECT CODE
      LDB CON1A     GET STARTING POINTER
MTDI1 LDA 1,I       GET INSTRUCTION 
      AND DM64      MASK OUTPUT OLD SELECT CODE 
      IOR MTSCD     MERGE IN NEW SLEECT CODE
      STA 1,I       SAVE IT 
      INB BE
      CPB CON2A     FINISHED DATA CHANNEL?
      ISZ MTSCD     YES, BUMP SELECT DOE
      CPB CON3A     FINISHED COMMAND CHANNEL? 
      JMP MTDIN,I   YES 
      JMP MTDI1     NO
CON1  DEF XT.3
      DEF XT.43 
      DEF XT.5
      DEF XT.50 
      DEF XT.13 FF
      DEF XT.2.]
      DEF XT.46 
      DEF XT.9
      DEF XT.11 
      DEF XT.12 2
CON2  DEF XS.1
      DEF XS.0
      DEF XLOOP P~
      DEF XT.20 
      DEF XT.15 5{
      DEF XT.0
      DEF XT.10 
      DEF XT.8
      DEF XT.14 
      DEF XT.1
      DEF XT.7
      DEF XT.6
      DEF O.B 
      DEF XT.4
      DEF XT.16 
CON3  EQU * 
DB101 OCT 101 
DB105 OCT 105 5@
DB110 OCT 110 
DB200 OCT 200 
DB215 OCT 215 
BUFL  NOP 
BUFA  NOP 
MTSCD NOP 
MTDER CLC 0,C 
      HLT 11B 
      JMP MTDM1 
WNEA DEF *+1
      OCT 512725
      ASC 8,RITE NOT ENABLED
      OCT 6400
MTLMA DEF *+1 
      OCT 5103
      ASC 11,HANGE MAG TAPE TO AUTO 
      OCT 6400
CON1A DEF CON1,I
CON2A DEF CON2,I
CON3A DEF CON3,I
DM64  DEC -64 
      HED      SYSTEM CONSOLE CONFIGURATOR      (D) 
*     


**        ENHANCMENT FOR REV D
* 
SC??  NOP           CHECK PRESENT CONFIGURATION     
      LDA FILLC     IS IT THE SAME AS THE 
      CPA FILLR     SYSTEM BEING LOADED?
      JMP SC??,I    YES, EXIT 
      CLA           NO, HAS THE CONSOLE BEEN
      CPA SCFIG     CONFIGURED YET? 
      JSB SCFIG     NO, CONFIGURE IT NOW
      LDA FILLC     IN ANY CASE SET THE BASE
      STA FILLR     LOCATION IN THE SYSTEM
      CLA           AND SET THE CONFIGURATOR
      STA SCFIG     FLAG
      JMP SC??,I    AND EXIT
* 
* 
SCFIG NOP 
      CCA           ASSUME TTY SYSTEM CONSOLE 
      STA FILLC 
      LDA .+38      SEE IF OPERATOR AGREES
      LDB CMSG      WITH ASSUMPTION 
      JSB TTY35 
      CLA         NOW GET RESPONSE
      JSB TTY35 
      JSB GETC,I  WANT FIRST CHARACTER
      JMP CER1    IF ANY
      CPA NO      WAS IT NO?
      JMP NODLY   YES, IT WAS NO
      CPA YES     NO, WAS IT YES? 
      JMP DELAY     BAD ASSUMPTION CONSOLE IS A HP 2762A
* 
CER1  LDA .+8     OUT PUT ERROR MESSAGE 
      LDB COMER   ??? 
      JSB TTY35 
      JMP SCFIG+1 AND TRY AGAIN 
* qq
DELAY LDA .-6       SET UP FOR HP 2762A 
      STA FILLC 
NODLY JMP SCFIG,I  EXIT 
* 
* 
YES   OCT 131 
NO    OCT 116 
GETC  DEF GETCR 
* 
CMSG  DEF *+1 
      OCT 6412
      ASC 17,IS THE SYSTEM CONSOLE AN HP 2762A? 
      OCT 6412
COMER DEF *+1 
      OCT 6412
      ASC 2,??? 
      OCT 6412
