*                 CATALOG NO. 704878 - BPM M:BITOTM
         SYSTEM   SIG7FDP
         PAGE
*                                   REGISTERS
R0       EQU      0
R1       EQU      1
R2       EQU      2
R3       EQU      3
R4       EQU      4
R6       EQU      6
SR3      EQU      10
SR4      EQU      11
         REF      M:BI,M:TM
F:IN     EQU      M:BI
F:OUT    EQU      M:TM
K2       EQU      2
K4       EQU      4
K6       EQU      6
ORG      EQU      5
KEYM     EQU      12
         PAGE
BITOTM   DSECT    1
         REF      J:DLL
         LD,6     J:DLL             RELEASE ALL UNUSED CORE
         SW,7     6
         AI,7     1
         SLS,6    9                 MAKE WORD ADDRESS
         MTB,5    6                 MAKE FVP FPT
         CAL1,8   6
         AI,6     512
         BDR,7    %-2
         LW,3     X'2A'             IF BOOT UNDER FILES, DONT COPY THEM
         REF      GENMD
         BLZ      GENMD
         CAL1,8   GP                GET A BUNCH OF MEMORY
         SLS,8    9                 SIZE IN WORDS
         AW,8     9                 END IN WORDS
         AI,8     -BUFFER           REAL SIZE IN WORDS
         SLS,8    2                 IN BTES
         STW,8    BUFSZ
*                                   TAPE TO DISK
*
TTD      EQU      %
         CAL1,1   OPNTPE
         BCS,0    TTD
         LCI      2
         LM,3     M:BI+23           IS THIS LASTLM
         CW,R3    TXLAS
         BNE      %+4
         SLS,4    -8
         CW,4     TXLAS+1
         BE       ABNTPE1
         CAL1,1   RSTTM             CLEAN OUT DC DCB
*
         LI,R3    X'F0'             ORG
         AND,R3   ORG+F:IN
         SLS,R3   -4
         LB,R4    KEYM+F:IN
         LI,R1    K4                OPEN AS UPDATE
TTD1     EQU      %
         CAL1,1   OPNDSK
         BCS,0    CLSIN
*
*                                   COPY RECORDS
TTD2     EQU      %
         CAL1,1   RDTPE
         CAL1,1   WRTDSK
         B        TTD2
*
*
RSTTM    GEN,8,24 X'14',M:TM
         DATA     X'7001'
         DATA     1
         DATA,1   3,,,,4,,,,5,,,,6,,,,11,1,,
OPNDSK   EQU      %
         GEN,8,24 X'14',F:OUT
         DATA     X'05480001'
         PZE      *3
         PZE      *1
         DATA     2                 SAVE
         DATA     X'80000004'       KEYM
FPARAM   EQU      %
         RES      90
*
*
*
OPNTPE   EQU      %
         GEN,8,24 X'14',F:IN
         DATA     X'01200402'
         DATA     1                 FUN
         DATA     FPARAM
         DATA     X'10000'
*
*
RDTPE    EQU      %
         GEN,8,24 X'10',F:IN
         DATA     X'F0000010'
         PZE      ERRABN0
         PZE      ERRABN0
         PZE      BUFFER
BUFSZ    DATA     0
*
*
WRTDSK   EQU      %
         GEN,8,24 X'11',F:OUT
         DATA     X'F8000050'
         PZE      ERRABN0
         PZE      ERRABN0
         PZE      BUFFER
         GEN,1,31 1,F:IN+13
         GEN,1,31 1,F:IN+10
*
ABNTPE0  CAL1,1   OPND              OPEN DEVICE TAPE
ABNTPE1  CAL1,1   CLSR
GENMD0   CAL1,8   FP
         B        GENMD             RETURN
FP       DATA     X'90000FF'
GP       DATA     X'80000FF'
M7       DATA     X'7F'
*
CLSOUT   EQU      %
         LI,1     F:OUT
         CAL1,1   CLS
CLSIN    EQU      %
         LI,1     F:IN
         CAL1,1   CLS
         B        TTD
*
LOSDATA  CAL1,1   CLSFIL
         CAL1,2   PR1
         CAL1,2   PR2
         B        CLSIN
CLSFIL   GEN,8,24 X'15',F:OUT
         DATA
PR1      GEN,8,24 1,0
         PZE      *0
         PZE      SKPMES
PR2      GEN,8,24 1,0
         PZE      *0
         PZE      F:IN+23
SKPMES   TEXTC    'CANNOT BOOT LMN'
CLS      EQU      %
         GEN,8,24 X'95',1
         DATA     X'80000000'
         DATA     2
*
*
*
*
*
EOFFIN   GEN,8,24 6,F:IN
TXLAS    DATA,1   6,'L','A','S',,'T','L','M'
CLSR     GEN,8,24 21,F:IN
         DATA     X'20'             REMOVE
OPND     GEN,8,24 20,F:IN
         DATA     3,-1
         PAGE
***********************************************************************
*        ERROR, ABNORMAL FROM M:BI, M:TM                              *
***********************************************************************
         DEF      ERRABN0
ERRABN0   LCI     5
         STM,7    REGS
         LI,11    0
         LI,9     X'1FFFF'
         CW,10    LASTTM
         BE       ABNTPE0
         CW,10    BUSYTM            IF BUSY MUST BE PATCH FILE
         BE       CLSIN             IGNORE ONE ON TAPE
         CW,10    NOFTM             OPEN UPDATE FAILED
         BNE      %+3               NO
         LI,1     2                 YES, TRY OUTPUT
         B        TTD1
         CW,10    EOFFIN            END OF THIS FILE ON TAPE
         BE       CLSOUT            YES  CLOSE OUTPUT FILE AND INTPUT
         CW,10    LOSDIN            LOST DATA INPUT
         BE       LOSDATA           YES, DO MESSAGEES, ETC.
         AI,8     -1                CAL ADDR
         ANLZ,7   *8                GET FPT ADDR
         LB,7     *7                GET OP CODE
         AND,7    M7
         AI,7     -X'12'
         BGEZ     %+2
         AI,7     2
         LW,7     OPS,7
         STW,7    MSG+4             PUT OP IN MSG
         SCS,10   8                 CONV CODE TO EBCDIC
         SLD,10   -4
         SLS,11   -28
         CI,11    9
         BG       %+2
         AI,11    10+'0'-'A'
         SLS,11   24
         SLD,10   -4
         SLS,11   -20
         AI,11    '0A'-10
         STH,11   MSG+3             PUT IN MSG
         LW,8     DCBS+1            GET WHAT
         LI,10    X'1FFFF'
         AND,10   REGS+3            DCB ADDR.IN REGS.(SR3)
         CI,10    M:TM
         BE       %+2
         LW,8     DCBS
         STW,8    MSG+11            PUT IN MSG
         AI,10    23
         LI,7     11
         LI,8     ' '                LAANK
         STB,8    MSG+7,7           BLANK HOLE
         BDR,7    %-1
         LB,7     *10               GET BYTE COUNT
         BEZ      %+4               NO NAME
         LB,8     *10,7             GET CHARS
         STB,8    MSG+7,7           OUT IN MSG
         BDR,7    %-2
         LI,10    MSG
         CAL1,2   MSGFPT
         LI,10    X'69'
         LW,8     REGS+1
         CB,10    *8
         BE       %+2               RETURN TO *CAL+1
         LI,8     8                 RETURN TO CAL+1
RETGO    EQU      %
         STS,8    RETB
RESREGS  LCI      5
         LM,7     REGS
RETB     B        *0
MSG      TEXTC    'IO ERR/ABN XX, XXXXING FILE XXXXXXXXXXX ON XXXX'
OPS      TEXT     'READWRITOPENCLOS'
DCBS     TEXT     'TAPEDISC'
MSGFPT   DATA     2**24,1**31,1**31+10
LASTTM   GEN,8,24 2,M:BI
REGS     EQU      BITOTM
NOFTM    GEN,8,24 3,M:TM
LOSDIN   GEN,8,24 7,M:BI
BUSYTM   GEN,8,7,17 20,1,M:TM
BUFFER   EQU      %
         END

