home *** CD-ROM | disk | FTP | other *** search
/ Oakland CPM Archive / oakcpm.iso / sigm / vol135 / mft50.asm < prev    next >
Encoding:
Assembly Source File  |  1984-04-29  |  25.4 KB  |  1,411 lines

  1. ;******************************************************
  2. ;*                              *
  3. ;*          MFT - Multiple File Transfer          *
  4. ;*           (for single drive systems)          *
  5. ;*                              *
  6. ;*    Based on an article in Dr. Dobbs Journal of     *
  7. ;*    Computer Calisthenics & Orthodontia #49,      *
  8. ;*          Box E, Menlo Park, Ca. 94025          *
  9. ;*                              *
  10. ;*  Vers 5.0 - 2/10/83 by William King (Time-11:32pm) *
  11. ;*           - Modified the main title (pretty).    *
  12. ;*           - Converted all code to Z-80 so it     *
  13. ;*           could be assembled with "EXASM.COM".   *
  14. ;*           - Optimised code for Z-80 (ie use      *
  15. ;*           LDIR,JR and DJNZ).              *
  16. ;*           - Added check on CP/M version No.      *
  17. ;*           - Using direct console I/O and using   *
  18. ;*           function No.30 (change file attributes)*
  19. ;*           - Close after a read file bug fixed.   *
  20. ;*           - Error check on opening a previous    *
  21. ;*           output file added.              *
  22. ;*       *** - User response routine added so when  *
  23. ;*           a file exists on the output disk, you  *
  24. ;*           may either erase it or leave it (this  *
  25. ;*           routine includes erasure of R/O files) *
  26. ;*           - MOVE routine deleted.              *
  27. ;*           - Fixed bug encounted when trying to   *
  28. ;*           copy r/o files (you couldn't!),by      *
  29. ;*           doing AND 07FH on ALL characters put   *
  30. ;*           into the filename table !!          *
  31. ;*           - Fixed filename printing stuff.          *
  32. ;*           - Spread out messages for readability. *
  33. ;*           - Changed size of filename table from  *
  34. ;*           64 entries to 128 entries, so large    *
  35. ;*           disk directories can be copied.          *
  36. ;*           - Added explanation of how each entry  *
  37. ;*           in the filename table is constructed.  *
  38. ;*                              *
  39. ;*     (***) = main bulk of code added.          *
  40. ;*                              *
  41. ;*  Vers 4.5 - 10/29/80 - Deleted system disk request *
  42. ;*           of V4.0 to shorten messages, minor     *
  43. ;*           changes in abort options and other     *
  44. ;*           messages. Moved disk reset of V4.1 to  *
  45. ;*           point before directory search. (CHS)   *
  46. ;*                              *
  47. ;*  Vers 4.4 - 10/28/80 - Modified to bail out with   *
  48. ;*           message if no FCB is specified.          *
  49. ;*           Updates rearranged with most recent    *
  50. ;*           first for reader convenience.          *
  51. ;*           (Charles H. Strom)              *
  52. ;*                              *
  53. ;*  VERS 4.3 - BY LEWIS MOSELEY, JR.  3/22/80          *
  54. ;*           FIXED BUG WHICH SHOWED UP WHEN MULTIPLE*
  55. ;*           COPIES WERE MADE OF A MULTIPLE EXTENT  *
  56. ;*           FILE, IN THAT CP/M OPEN THE NEXT EXTENT*
  57. ;*           USING THE DATA AREA TO SEARCH THE      *
  58. ;*           DIRECTORY, SCREWING UP THE DATA BLOCK  *
  59. ;*           THAT IS THERE.                  *
  60. ;*                              *
  61. ;*  VERS 4.2 - BY LEWIS MOSELEY, JR.  2/23/80          *
  62. ;*           FIXED BUG THAT OCCURRED WHEN ONLY A    *
  63. ;*           SINGLE FILE WAS SPECIFIED AND THAT     *
  64. ;*           FILE WAS NOT FOUND : PROGRAM HUNG IN A *
  65. ;*           LOOP.                      *
  66. ;*                              *
  67. ;*  VERS 4.1 - BY LES FREED AND LEWIS MOSELEY 2/11/80 *
  68. ;*           ADDED DISK RESET ON DISK CHANGE TO     *
  69. ;*           ALLOW CHANGING DENSITY BETWEEN DISKS   *
  70. ;*           ADDED CTL-C ABORT              *
  71. ;*                              *
  72. ;*  VERS 4.0 - BY LEWIS MOSELEY, JR.  12/79          *
  73. ;*           ADDED OPTION FOR MULTIPLE OUTPUT          *
  74. ;*           COPIES ADDED REQUEST FOR SYSTEM DISK   *
  75. ;*           BEFORE REBOOT                  *
  76. ;*                              *
  77. ;*           l.e. hughes    (9/1979)              *
  78. ;*           mycroft labs                  *
  79. ;*           atlanta, ga                  *
  80. ;*                              *
  81. ;*  MODIFIED - FOR SOL & COMPATABLE COMPUTERS BY      *
  82. ;*           LEWIS MOSELEY, JR. - ATLANTA,GA.          *
  83. ;*                              *
  84. ;******************************************************
  85.  
  86.  
  87. ;*  EQUATES  *
  88.  
  89.  
  90. VERSION EQU    5
  91. MODLEV    EQU    0
  92.  
  93. ENTRY:    EQU    0005H          ;bdos entry point
  94. TFCB:    EQU    005CH          ;system file control blk
  95. DBUF:    EQU    0080H          ;system disk buffer
  96.  
  97. CR:    EQU    0DH
  98. LF:    EQU    0AH
  99.  
  100. RCFC:    EQU    01          ;read console
  101. WCFC:    EQU    02          ;write console
  102. CONSOL: EQU    06          ;direct console i/o
  103. VERS:    EQU    12          ;version number function
  104. RDFC:    EQU    13          ;reset disk
  105. OFFC:    EQU    15          ;open file
  106. CFFC:    EQU    16          ;close file
  107. SFFC:    EQU    17          ;search first
  108. SNFC:    EQU    18          ;search next
  109. DFFC:    EQU    19          ;delete file
  110. RRFC:    EQU    20          ;read record
  111. WRFC:    EQU    21          ;write record
  112. MFFC:    EQU    22          ;make file
  113. SAFC:    EQU    26          ;set address
  114.  
  115. FN:    EQU    01          ;file name offset
  116. FT:    EQU    09          ;file type offset
  117. EX:    EQU    12          ;extent number offset
  118. NR:    EQU    32          ;next record offset
  119.  
  120.  
  121.     ORG    00100H
  122.  
  123.  
  124. MFT:    LD    SP,STACK+64
  125.     LD    HL,MSG1          ;print 'MFT V5.0'
  126.     CALL    WASC
  127.  
  128.     LD    C,VERS          ;get version #
  129.     CALL    ENTRY
  130.     LD    A,L
  131.     CP    020H          ;vers >= 2.0 ?
  132.     JR    NC,OK1-$      ;yes,then go on
  133.  
  134.     LD    HL,BADVER     ;"Sorry you need 2.0"
  135.     CALL    WASC
  136.  
  137. OK2:    LD    HL,MSGG          ;"type ^c"
  138.     CALL    WASC
  139.  
  140.     CALL    RACC
  141.     CP    3
  142.     JR    NZ,OK2-$
  143.  
  144.     JP    00000H          ;reboot
  145.  
  146. OK1:    XOR    A          ;clear break flags
  147.     LD    (IBFLG),A
  148.     LD    (OBFLG),A
  149.     LD    (NDFLG),A     ;CLEAR NO DUP FLAG
  150.  
  151.     LD    A,(TFCB+1)    ;If no FCB specified
  152.     CP    ' '          ;then say so
  153.     JR    NZ,OK-$
  154.  
  155.     LD    HL,MSGK          ;and bail out
  156.     CALL    WASC          ;here
  157.     JP    00000H
  158.  
  159. ;*  calculate buffer size = fwa(BDOS) - fwa(MBUF)  *
  160.  
  161. OK:    LD    HL,(ENTRY+1)  ;hl = (entry+1) - 6
  162.     LD    DE,-6
  163.     ADD    HL,DE
  164.     LD    A,L
  165.     AND    80H          ;hl = hl mod 128
  166.     LD    L,A
  167.     LD    DE,MBUF          ;hl = hl - fwa(MBUF)
  168.     LD    A,L
  169.     SUB    E
  170.     LD    L,A
  171.     LD    A,H
  172.     SBC    A,D
  173.     LD    H,A
  174.     ADD    HL,HL          ;hl = hl / 128
  175.     LD    L,H
  176.     LD    A,0          ;don't touch cf
  177.     ADC    A,0
  178.     LD    H,A
  179.     DEC    HL          ;subtract one
  180.     LD    (SPACE),HL    ;save as buffer size
  181.     PUSH    HL          ;save size
  182.  
  183.     LD    HL,MSG2          ;write 'Buffer size = '
  184.     CALL    WASC
  185.  
  186.     POP    HL          ;get size back
  187.     CALL    WDWC          ;print size of buffer
  188.  
  189.     LD    HL,MSG3          ;write ' sectors'
  190.     CALL    WASC
  191.  
  192. ;*  ask user to mount input disk  *
  193.  
  194. MFT1:    LD    HL,MSG4          ;"Mount input disk,"
  195.     CALL    WASC
  196.  
  197.     CALL    RACC          ;read response
  198.     CP    03          ;CTL-C ?
  199.     JP    Z,MFTL          ;ABORT WITH MESSAGE
  200.  
  201.     CP    CR          ;loop if anything but CR
  202.     JR    NZ,MFT1-$
  203.  
  204.     CALL    WEOLC          ;echo CR,LF
  205.  
  206.     CALL    RESET          ;adjust density
  207.  
  208.     LD    A,(IBFLG)     ;jump if ibflg set
  209.     OR    A
  210.     JR    NZ,MFT2A-$
  211.  
  212. ;*  copy command line into cbuf     *
  213.  
  214.     LD    HL,DBUF          ;fwa of command line
  215.                   ;image
  216.     LD    DE,CBUF          ;fwa of command buffer
  217.     LD    B,(HL)          ;fetch comm. line length
  218.     INC    HL
  219. MFT2:    LD    A,(HL)          ;fetch next byte from cli
  220.     INC    HL
  221.     LD    (DE),A          ;store in dbuf
  222.     INC    DE
  223.     DEC    B          ;decrement count
  224.     JR    NZ,MFT2-$     ;loop until zero
  225.  
  226.     XOR    A          ;store zero byte at end
  227.     LD    (DE),A
  228.  
  229.     LD    HL,CBUF          ;reset cbufp
  230.     LD    (CBUFP),HL
  231.  
  232.     CALL    CFNT          ;create file name table
  233.  
  234.     LD    HL,FNT          ;reset fnt pointers
  235.     LD    (IFNTP),HL
  236.     LD    (OFNTP),HL
  237.  
  238. MFT2A:    LD    HL,MBUF          ;reset mbuf pointer
  239.     LD    (MBUFP),HL
  240.  
  241.     LD    HL,(SPACE)    ;reset msize
  242.     LD    (MSIZE),HL
  243.  
  244.     LD    A,(IBFLG)     ;jump if ibflg not set
  245.     OR    A
  246.     JR    Z,MFT3-$
  247.  
  248.     LD    A,(NERAS)     ;get last file not 
  249.                   ;written flag
  250.     OR    A
  251.     JR    Z,MFT2B-$     ;not set the read more of
  252.                   ;previously opened file
  253.  
  254.     XOR    A
  255.     LD    (NERAS),A
  256.     LD    (IBFLG),A
  257.     LD    (OBFLG),A
  258.  
  259.     JR    MFT3-$
  260.  
  261. MFT2B:    LD    HL,IFCB          ;copy IFCB into TFCB
  262.     LD    DE,TFCB
  263.     LD    BC,33
  264.     LDIR              ;move the stuff
  265.  
  266.     XOR    A          ;clear ibflg
  267.     LD    (IBFLG),A
  268.     INC    A          ;set obflg
  269.     LD    (OBFLG),A
  270.  
  271.     LD    HL,(IFNTP)    ;back ifntp up 4 bytes
  272.     LD    DE,-4
  273.     ADD    HL,DE
  274.     LD    (IFNTP),HL
  275.  
  276.     LD    HL,TFCB+FN    ;write filename
  277.     CALL    WFNC
  278.     LD    HL,MSG6          ;write ' - '
  279.     CALL    WASC
  280.  
  281.     LD    HL,(IFNTP)    ;DE = ifntp
  282.     EX    DE,HL
  283.  
  284.     JR    MFT4-$          ;continue reading
  285.                   ;previous file
  286.  
  287. ;*  parse off next name from cbuf  *
  288.  
  289. MFT3:    LD    HL,(IFNTP)    ;fetch input fnt pointer
  290.     LD    A,(HL)          ;jump if end of table
  291.     CP    0FFH
  292.     JP    Z,MFT9
  293.  
  294.     LD    (HL),1          ;set 'file has been read'
  295.                   ; flag
  296.     INC    HL
  297.     LD    DE,TFCB+FN    ;copy filename into tfcb
  298.     LD    BC,11
  299.     LDIR              ;move the stuff
  300.  
  301.     LD    (IFNTP),HL    ;save input fnt pointer
  302.  
  303.     LD    HL,TFCB+FN    ;write filename
  304.     CALL    WFNC
  305.  
  306.     LD    HL,MSG6           ;write ' - '
  307.     CALL    WASC
  308.  
  309.     XOR    A          ;setup tfcb
  310.     LD    (TFCB),A
  311.     LD    (TFCB+EX),A
  312.     LD    (TFCB+NR),A
  313.  
  314.     CALL    OPEN          ;open file
  315.     LD    HL,(IFNTP)
  316.     EX    DE,HL
  317.  
  318. MFT4:    LD    HL,(MBUFP)
  319.     LD    A,H          ;copy into fnt entry
  320.     LD    (DE),A
  321.     INC    DE
  322.     LD    A,L
  323.     LD    (DE),A
  324.     INC    DE
  325.     EX    DE,HL          ;save fnt pointer
  326.     LD    (IFNTP),HL
  327.  
  328.     LD    HL,0          ;file size (in secs.) = 0
  329.     LD    (FSIZE),HL
  330.  
  331. ;*  read next file from input disk  *
  332.  
  333. MFT6:    LD    HL,(MBUFP)
  334.     EX    DE,HL
  335.     CALL    SETDMA
  336.     CALL    READ          ;read next sector
  337.     OR    A          ;jump if normal transfer
  338.     JR    Z,MFT7-$
  339.  
  340.     CP    1          ;jump if EOF
  341.     JR    Z,MFT8-$
  342.  
  343.     LD    HL,MSG8          ;write 'read error - '
  344.     CALL    WASC
  345.     JR    MFT8-$          ;continue as if EOF
  346.  
  347. MFT7:    LD    HL,(MBUFP)    ;mbufp = mbufp + 128
  348.     LD    DE,128
  349.     ADD    HL,DE
  350.     LD    (MBUFP),HL
  351.  
  352.     LD    HL,(FSIZE)    ;fsize = fsize + 1
  353.     INC    HL
  354.     LD    (FSIZE),HL
  355.  
  356.     LD    HL,(MSIZE)    ;decrement msize
  357.     DEC    HL
  358.     LD    (MSIZE),HL
  359.  
  360.     LD    A,H          ;loop if still positive
  361.     OR    L
  362.     JR    NZ,MFT6-$
  363.  
  364.     LD    HL,TFCB          ;copy tfcb into ifcb
  365.     LD    DE,IFCB
  366.     LD    BC,33
  367.     LDIR              ;move the stuff
  368.  
  369.     LD    A,1          ;set ibflg
  370.     LD    (IBFLG),A
  371.  
  372. MFT8:    LD    DE,DBUF          ;reset dma pointer
  373.     CALL    SETDMA
  374.                   ;deleted close file from
  375.                   ;here (don't close after
  376.                   ;a read !!)
  377.  
  378.     LD    HL,(FSIZE)    ;write file size
  379.     CALL    WDWC
  380.  
  381.     LD    HL,MSG9          ;write ' sectors read'
  382.     CALL    WASC
  383.  
  384. ;*  update fnt, loop  *
  385.  
  386.     LD    HL,(FSIZE)    ;DE = file size
  387.     EX    DE,HL
  388.     LD    HL,(IFNTP)    ;store file size in fnt
  389.                   ;entry
  390.     LD    (HL),D
  391.     INC    HL
  392.     LD    (HL),E
  393.     INC    HL
  394.     LD    (IFNTP),HL    ;save fnt pointer
  395.  
  396.     LD    A,(IBFLG)     ;loop if ibflg not set
  397.     OR    A
  398.     JP    Z,MFT3
  399.  
  400. ;*  FLAG THAT THE MEMORY BUFFER HAS BEEN EXCEEDED,  *
  401. ;*  TELL USER THAT DUPLICATE COPIES CANNOT BE MADE  *
  402.  
  403.     LD    A,(NDFLG)     ;TOLD HIM ALREADY?
  404.     OR    A
  405.     JR    NZ,MFT9-$     ;JUMP IF SO
  406.  
  407.     LD    HL,MSGH          ;IF NOT, TELL HIM
  408.     CALL    WASC
  409.  
  410.     LD    A,1          ;SET NDFLG THIS TIME
  411.     LD    (NDFLG),A
  412.  
  413. ;*  Ask user to mount output disk  *
  414.  
  415. MFT9:    LD    HL,MSGA          ;"Mount output disk,"
  416.     CALL    WASC
  417.     CALL    RACC          ;read response
  418.     CP    03          ;CTL-C?
  419.     JP    Z,MFTL          ;ABORT WITH MESSAGE IF SO
  420.     CP    CR          ;loop if anything but CR
  421.     JR    NZ,MFT9-$
  422.  
  423.     CALL    WEOLC          ;echo CR,LF
  424.     CALL    RESET          ;reset disk system, make
  425.                   ; r/w and check density
  426.     LD    A,(OBFLG)     ;jump if obflg not set
  427.     OR    A
  428.     JR    Z,MFTA-$
  429.  
  430.     LD    HL,OFCB          ;copy ofcb into tfcb
  431.     LD    DE,TFCB
  432.     LD    BC,33
  433.     LDIR              ;move the stuff
  434.  
  435.     CALL    OPEN          ;open previous file
  436.     CP    255          ;previous file present?
  437.     JR    NZ,MFT9B-$    ;yes,then ok to go on
  438.  
  439.     LD    HL,REOPER     ;"Reopen error!!"
  440.     CALL    WASC
  441.  
  442. MFT9A:    LD    HL,MSGG          ;"press ^c to reboot"
  443.     CALL    WASC
  444.  
  445.     CALL    RACC          ;get a char
  446.     CP    03          ;"^C"?
  447.     JR    NZ,MFT9A-$    ;no,then get proper ans.
  448.  
  449.     JP    00000H          ;reboot
  450.  
  451. MFT9B:    LD    HL,(OFNTP)    ;backup output fnt
  452.                   ; pointer 4 bytes
  453.     LD    DE,-4
  454.     ADD    HL,DE
  455.     LD    (OFNTP),HL
  456.  
  457.     LD    HL,TFCB+FN    ;write file name
  458.     CALL    WFNC
  459.     LD    HL,MSG6          ;write ' - '
  460.     CALL    WASC
  461.     JP    MFTB          ;continue writing
  462.                   ; previous file
  463.  
  464. ;*  write next file to output disk  *
  465.  
  466. MFTA:    LD    HL,(OFNTP)
  467.     LD    A,(HL)          ;get file read flag
  468.     OR    A          ;last read in file
  469.     JP    Z,MFTF          ;yes,then end of write
  470.  
  471.     CP    0FFH          ;end of filename table?
  472.     JP    Z,MFTF          ;yes,then go
  473.  
  474.     INC    HL
  475.     LD    DE,TFCB+FN
  476.     LD    BC,11
  477.     LDIR              ;move the stuff
  478.  
  479.     LD    (OFNTP),HL
  480.  
  481.     LD    HL,TFCB+FN    ;print "filename"
  482.     CALL    WFNC
  483.  
  484.     LD    HL,MSG6          ;print " - "
  485.     CALL    WASC
  486.  
  487.     XOR    A
  488.     LD    (TFCB),A
  489.     LD    (TFCB+EX),A
  490.     LD    (TFCB+NR),A
  491.  
  492. ;*  Start of version 5.0 erase mods  *
  493.  
  494.     LD    DE,TFCB
  495.     CALL    SRCHF          ;does file already exist?
  496.     CP    255
  497.     JP    Z,MFTAA          ;no,then normal write
  498.  
  499.     LD    (SAVE),A      ;save dir pointer
  500.  
  501.     LD    HL,TFCB          ;copy tfcb into ofcb
  502.     LD    DE,OFCB
  503.     LD    BC,33
  504.     LDIR              ;move the stuff
  505.  
  506.     LD    HL,MSGL          ;"file exists. erase?"
  507.     CALL    WASC
  508.  
  509. LOOK:    LD    C,CONSOL      ;input char with no echo
  510.     LD    E,0FFH
  511.     CALL    ENTRY
  512.     CP    'N'
  513.     JR    Z,LOOK1-$
  514.     CP    'Y'
  515.     JR    NZ,LOOK-$
  516.  
  517. LOOK1:    PUSH    AF          ;save answer
  518.     LD    C,CONSOL      ;echo the char
  519.     LD    E,A
  520.     CALL    ENTRY
  521.     CALL    WEOLC          ;do cr-lf
  522.     POP    AF          ;get answer back
  523.  
  524.     CP    'Y'
  525.     JR    Z,LOOK5-$     ;if yes then delete file
  526.  
  527.     LD    A,1
  528.     LD    (NERAS),A     ;set last file not
  529.                   ;written flag
  530.  
  531.     LD    HL,(OFNTP)    ;get fnt pointer
  532.     INC    HL
  533.     INC    HL
  534.     INC    HL
  535.     INC    HL          ;point to next entry
  536.  
  537. LOOK2:    PUSH    HL          ;save for later
  538.     INC    HL          ;point to next filename
  539.     LD    DE,TFCB+FN    ;point to last filename
  540.     LD    B,11          ;length to test
  541.  
  542. LOOK3:    LD    A,(DE)          ;compare the names
  543.     CP    (HL)
  544.     JR    NZ,LOOK4-$    ;if they are NOT the same
  545.                   ;then go ahead and use
  546.                   ;the name being compared
  547.  
  548.     INC    HL
  549.     INC    DE
  550.     DJNZ    LOOK3-$          ;do whole name
  551.  
  552.                   ;if here then both names
  553.                   ;are the same thus don't
  554.                   ;use this name in fnt.
  555.                   ;must point to next name
  556.                   ;after this name
  557.  
  558.     POP    HL          ;get this fnt pointer
  559.     LD    DE,16          ;offset
  560.     ADD    HL,DE
  561.  
  562.     LD    A,(HL)          ;check if this file read
  563.     OR    A
  564.     JP    Z,MFTF          ;no,not read yet
  565.     CP    0FFH          ;end of table?
  566.     JP    Z,MFTF          ;yes,end of fnt reached
  567.  
  568.     JR    LOOK2-$          ;compare next file
  569.  
  570.                   ;must keep comparing name
  571.                   ;until : a no-match ;
  572.                   ;or end of table or last
  573.                   ;read file is found.
  574.  
  575. LOOK4:    POP    HL          ;get fnt pointer back
  576.     LD    (OFNTP),HL    ;save it for much later
  577.     JP    MFTA          ;do next file
  578.  
  579. LOOK5:    LD    HL,TFCB+FN    ;"filename"
  580.     CALL    WFNC
  581.     LD    HL,MSG6          ;" - "
  582.     CALL    WASC
  583.  
  584.     LD    A,(SAVE)      ;get dir pointer back
  585.     AND    3
  586.     LD    L,A
  587.     LD    H,0
  588.     ADD    HL,HL
  589.     ADD    HL,HL
  590.     ADD    HL,HL
  591.     ADD    HL,HL
  592.     ADD    HL,HL          ;get offset into dir blk.
  593.     LD    DE,DBUF+FT    ;point to filetype byte
  594.                   ;in found dir entry.
  595.     ADD    HL,DE
  596.     LD    A,(HL)          ;1st filetype byte
  597.     BIT    7,A          ;check for r/o = set
  598.     JR    Z,LOOK7-$     ;not set,then erase ok
  599.  
  600.                   ;here if file to be
  601.                   ;erased is r/o. Ask Q
  602.                   ;if want erase anyway?
  603.  
  604.     LD    HL,FILERO     ;"file is r/o. Erase?"
  605.     CALL    WASC
  606.  
  607. LOOK6:    LD    C,CONSOL      ;get char
  608.     LD    E,0FFH
  609.     CALL    ENTRY
  610.     CP    'N'
  611.     JP    Z,LOOK1          ;don't erase it
  612.  
  613.     CP    'Y'
  614.     JR    NZ,LOOK6-$
  615.  
  616.     LD    C,CONSOL      ;echo
  617.     LD    E,A
  618.     CALL    ENTRY
  619.     CALL    WEOLC          ;cr-lf
  620.  
  621.     LD    DE,TFCB
  622.     LD    C,30          ;set file attr. to r/w
  623.     CALL    ENTRY
  624.  
  625.     LD    HL,TFCB+FN    ;"filename"
  626.     CALL    WFNC
  627.     LD    HL,MSG6          ;" - "
  628.     CALL    WASC
  629.  
  630. LOOK7:    XOR    A
  631.     LD    (TFCB),A
  632.     LD    (TFCB+EX),A
  633.     LD    (TFCB+NR),A
  634.  
  635.     CALL    DELT          ;delete existing file
  636.  
  637. ;*  End of version 5.0 erase mods  *
  638.  
  639. MFTAA:    LD    HL,TFCB          ;copy tfcb into ofcb
  640.     LD    DE,OFCB
  641.     LD    BC,33
  642.     LDIR              ;move the stuff
  643.  
  644.     CALL    MAKE
  645.     CP    255          ;jump if ok
  646.     JR    NZ,MFTB-$
  647.  
  648.     LD    HL,MSGB          ;write 'unable to create'
  649.     CALL    WASC
  650.     JP    MFTG
  651.  
  652. MFTB:    LD    HL,(OFNTP)
  653.     LD    D,(HL)          ;fetch fwa of file from
  654.                   ; fnt
  655.     INC    HL
  656.     LD    E,(HL)
  657.     INC    HL
  658.     EX    DE,HL
  659.     LD    (MBUFP),HL    ;save it
  660.     EX    DE,HL
  661.     LD    D,(HL)          ;fetch size of file from
  662.                   ; fnt
  663.     INC    HL
  664.     LD    E,(HL)
  665.     INC    HL
  666.     EX    DE,HL
  667.     LD    (FSIZE),HL    ;save it
  668.     LD    (XSIZE),HL    ;save for printout
  669.     EX    DE,HL
  670.     LD    (OFNTP),HL
  671.     LD    HL,(FSIZE)    ;jump if fsize=0
  672.     LD    A,H
  673.     OR    L
  674.     JR    Z,MFTDA-$
  675.  
  676. MFTC:    LD    HL,(MBUFP)    ;set dma address to mbufp
  677.     EX    DE,HL
  678.     CALL    SETDMA
  679.     CALL    WRITE          ;write next sector
  680.     OR    A          ;jump if ok
  681.     JR    Z,MFTD-$
  682.  
  683.     LD    HL,MSGC          ;"error writing file"
  684.     CALL    WASC
  685.     JP    MFTG
  686.  
  687. MFTD:    LD    HL,(MBUFP)    ;mbufp = mbufp + 128
  688.     LD    DE,128
  689.     ADD    HL,DE
  690.     LD    (MBUFP),HL
  691.  
  692.     LD    HL,(FSIZE)    ;fsize = fsize - 1
  693.     DEC    HL
  694.     LD    (FSIZE),HL
  695.  
  696.     LD    A,H          ;loop until zero
  697.     OR    L
  698.     JR    NZ,MFTC-$
  699.  
  700. MFTDA:    LD    HL,TFCB          ;copy tfcb into ofcb
  701.     LD    DE,OFCB
  702.     LD    BC,33
  703.     LDIR              ;move the stuff
  704.  
  705.     LD    DE,DBUF          ;reset dma pointer
  706.     CALL    SETDMA
  707.     CALL    CLOSE          ;try to close file
  708.     CP    255          ;jump if ok
  709.     JR    NZ,MFTE-$
  710.  
  711.     LD    HL,MSGD          ;write 'unable to close'
  712.     CALL    WASC
  713.  
  714. MFTE:    LD    HL,(XSIZE)    ;number of sectors done
  715.     CALL    WDWC
  716.  
  717.     LD    HL,MSGE          ;write ' sectors written'
  718.     CALL    WASC
  719.  
  720.     XOR    A
  721.     LD    (NERAS),A     ;clear last file not
  722.                   ;writen flag
  723.  
  724.     JP    MFTA
  725.  
  726. MFTF:    LD    A,(IBFLG)     ;loop if ibflg set
  727.     OR    A
  728.     JP    NZ,MFT1
  729.  
  730.  
  731. ;*  Terminate program here on irrecoverable error or  *
  732. ;*  when all files have been copied.  Must reload     *
  733. ;*  system disk to avoid crash when copying to          *
  734. ;*  someone else's disk.                              *
  735. ;*  If normal end, and if buffer has not been          *
  736. ;*  exceeded, give user the option of making another  *
  737. ;*  copy of the same set of files.              *
  738.  
  739.  
  740. MFTG:    LD    HL,MSGF          ;SEE IF OPTION IS ALLOWED
  741.     LD    A,(NDFLG)
  742.     OR    A
  743.     JR    NZ,MFTH-$     ;JUMP IF NOT ALLOWED
  744.  
  745.     CALL    WASC          ;ELSE TELL ABOUT OPTION
  746.  
  747. MFTH:    LD    HL,MSGG          ;ASK FOR SYSTEM DISK
  748.     CALL    WASC
  749.     CALL    RACC          ;wait for response
  750.     CP    03H          ;WARM BOOT IF ^C
  751.     JP    Z,00000H
  752.  
  753.     CP    CR          ;ATTEMPT REPEAT IF <CR>
  754.     JR    NZ,MFTG-$     ;LOOP TILL GOOD RESPONSE
  755.  
  756. MFTJ:    CALL    WEOLC          ;ACKNOWLEDGE COMMAND
  757.     LD    A,(NDFLG)     ;REPEAT ALLOWED?
  758.     OR    A
  759.     JR    NZ,MFTK-$     ;JUMP IF NOT
  760.  
  761.     LD    HL,FNT           ;ELSE RESET FNT POINTER
  762.     LD    (OFNTP),HL
  763.  
  764.     LD    HL,MBUF          ;RESET MEM BUF POINTER
  765.     LD    (MBUFP),HL
  766.  
  767.     XOR    A          ;RESET OUTPUT INTERRUPTED
  768.                   ; FLAG
  769.     LD    (OBFLG),A
  770.     JP    MFT9          ;AND DO AGAIN
  771.  
  772. MFTK:    LD    HL,MSGH          ;CANNOT REPEAT, TELL HIM
  773.     CALL    WASC
  774.     JR    MFTG-$          ;AND WAIT FOR SYSTEM DISK
  775.  
  776. MFTL:    LD    HL,MSGJ          ;ABORT MESSAGE
  777.     CALL    WASC
  778.     JP    00000H          ;WARM BOOT
  779.  
  780. ;*  subroutines     *
  781.  
  782.                   ;MOVE deleted from here
  783.  
  784. ;*  gfn - get file name     *
  785.  
  786. GFN:    LD    A,(HL)
  787.     OR    A
  788.     RET    Z
  789.  
  790.     CP    ' '
  791.     JR    NZ,GFN0-$
  792.  
  793.     INC    HL
  794.     JR    GFN-$
  795.  
  796. GFN0:    LD    DE,XFCB
  797.     XOR    A
  798.     LD    (DE),A
  799.     INC    DE
  800.     PUSH    DE
  801.     LD    B,11
  802.     LD    A,' '
  803. GFN6:    LD    (DE),A
  804.     INC    DE
  805.     DEC    B
  806.     JR    NZ,GFN6-$
  807.  
  808.     POP    DE
  809.     LD    B,9
  810. GFN1:    LD    A,(HL)
  811.     OR    A
  812.     JP    Z,GFN4
  813.  
  814.     INC    HL
  815.     CP    ' '
  816.     JP    Z,GFN4
  817.  
  818.     CP    '.'
  819.     JR    Z,GFN2-$
  820.  
  821.     CP    '*'
  822.     JR    Z,GFN7-$
  823.  
  824.     LD    (DE),A
  825.     INC    DE
  826.     DEC    B
  827.     JP    Z,GFN5
  828.     JR    GFN1-$
  829.  
  830. GFN7:    DEC    B
  831.     JR    Z,GFN9-$
  832.     LD    A,'?'
  833.     LD    (DE),A
  834.     INC    DE
  835.     JR    GFN7-$
  836.  
  837. GFN9:    LD    A,(HL)
  838.     CP    '.'
  839.     JR    NZ,GFN4-$
  840.     INC    HL
  841. GFN2:    LD    DE,XFCB+FT
  842.     LD    B,4
  843. GFN3:    LD    A,(HL)
  844.     OR    A
  845.     JR    Z,GFN4-$
  846.  
  847.     INC    HL
  848.     CP    ' '
  849.     JR    Z,GFN4-$
  850.  
  851.     CP    '*'
  852.     JR    Z,GFN8-$
  853.     LD    (DE),A
  854.     INC    DE
  855.     DEC    B
  856.     JR    Z,GFN5-$
  857.     JR    GFN3-$
  858.  
  859. GFN8:    DEC    B
  860.     JR    Z,GFN4-$
  861.     LD    A,'?'
  862.     LD    (DE),A
  863.     INC    DE
  864.     JR    GFN8-$
  865.  
  866. GFN4:    XOR    A
  867.     RET
  868.  
  869. GFN5:    SCF
  870.     RET
  871.  
  872. ;*  cfnt - create file name table  *
  873.  
  874. CFNT:    LD    HL,FNT          ;reset ifntp
  875.     LD    (IFNTP),HL
  876.     LD    (HL),0FFH     ;VER 4.2 BUG FIX 
  877. CFNT1:    LD    HL,(CBUFP)    ;get cbufp
  878.     LD    A,(HL)          ;exit if end of list
  879.     OR    A
  880.     RET    Z
  881.  
  882.     CALL    GFN          ;get next afn
  883.     LD    (CBUFP),HL    ;save command buffer ptr
  884.     JR    NC,CFNT2-$    ;jump if filename ok
  885.  
  886.     LD    HL,MSG5          ;"Syntax error in name"
  887.     CALL    WASC
  888.     JR    CFNT1-$          ;loop
  889.  
  890. CFNT2:    XOR    A          ;clear xfcb extent field
  891.     LD    (XFCB+EX),A
  892.  
  893.     LD    DE,XFCB          ;search for first occur.
  894.     CALL    SRCHF
  895.     CP    255          ;jump if found
  896.     JR    NZ,CFNT3-$
  897.  
  898.     LD    HL,XFCB+FN    ;write filename
  899.     CALL    WFNC
  900.     LD    HL,MSG7           ;write ' not found'
  901.     CALL    WASC
  902.     JR    CFNT1-$          ;loop
  903.  
  904. CFNT3:    AND    3          ;index into cbuf
  905.     LD    L,A
  906.     LD    H,0
  907.     ADD    HL,HL
  908.     ADD    HL,HL
  909.     ADD    HL,HL
  910.     ADD    HL,HL
  911.     ADD    HL,HL
  912.     LD    DE,DBUF
  913.     ADD    HL,DE
  914.     EX    DE,HL          ;copy filename into fnt
  915.     LD    HL,(IFNTP)
  916.     EX    DE,HL
  917.     LD    B,12
  918.  
  919. CFNT4:    LD    A,(HL)
  920.     AND    07FH          ;set bit 7 to 0 !!!
  921.     LD    (DE),A
  922.     INC    HL
  923.     INC    DE
  924.     DJNZ    CFNT4-$
  925.  
  926.     LD    HL,ZEROS      ;zero fill rest of entry
  927.     LD    BC,4
  928.     LDIR              ;move the stuff
  929.  
  930.     EX    DE,HL
  931.     LD    (IFNTP),HL    ;save input fnt pointer
  932.     LD    (HL),0FFH     ;insure FF byte at end
  933.  
  934.     LD    DE,XFCB          ;search for next occur.
  935.     CALL    SRCHN
  936.     CP    255          ;jump if found
  937.     JR    NZ,CFNT3-$
  938.  
  939.     JP    CFNT1          ;go get next afn
  940.  
  941. ;*  wasc - write ascii string to console  *
  942.  
  943. WASC:    LD    A,(HL)
  944.     OR    A
  945.     RET    Z
  946.  
  947.     CALL    WACC
  948.     INC    HL
  949.     JR    WASC-$
  950.  
  951.  
  952. ;*  wfnc - write file name to console              *
  953.  
  954. ;*  Note: Under SOLOS and CUTER, 01 is the cursor-    *
  955. ;*      left character.                  *
  956. ;*      When MFTing a multi-extent file, the extent *
  957. ;*      character must be filtered out of the file- *
  958. ;*      name-block to avoid wierd console output.   *
  959.  
  960. WFNC:    PUSH    BC
  961.  
  962.     LD    B,8
  963.  
  964. WFNC1:    LD    A,(HL)
  965.     AND    07FH
  966.     CALL    WACC
  967.     INC    HL
  968.     DJNZ    WFNC1-$
  969.  
  970.     LD    A,'.'
  971.     CALL    WACC
  972.  
  973.     LD    B,3
  974.  
  975. WFNC2:    LD    A,(HL)
  976.     AND    07FH
  977.     CALL    WACC
  978.     INC    HL
  979.     DJNZ    WFNC2-$
  980.  
  981.     POP    BC
  982.     RET
  983.  
  984. ;*  weolc - write end of line to console  *
  985.  
  986. WEOLC:    PUSH    AF
  987.     LD    A,CR
  988.     CALL    WACC
  989.     LD    A,LF
  990.     CALL    WACC
  991.     POP    AF
  992.     RET
  993.  
  994. ;*  wdwc - write decimal word to console  *
  995.  
  996. WDWC:    PUSH    HL
  997.     PUSH    DE
  998.     PUSH    BC
  999.     LD    B,0          ;clear 'digit written'
  1000.                   ; flag
  1001.     LD    DE,10000      ;write 1st digit
  1002.     CALL    WNDD
  1003.     LD    DE,1000          ;write 2nd digit
  1004.     CALL    WNDD
  1005.     LD    DE,100          ;write 3rd digit
  1006.     CALL    WNDD
  1007.     LD    DE,10          ;write 4th digit
  1008.     CALL    WNDD
  1009.     LD    DE,1          ;write 5th digit
  1010.     LD    B,1          ;force last digit to
  1011.                   ;print
  1012.     CALL    WNDD
  1013.     POP    BC
  1014.     POP    DE
  1015.     POP    HL
  1016.     RET
  1017.  
  1018. WNDD:    LD    C,0          ;c=0
  1019. WNDD1:    LD    A,L          ;hl = hl - de
  1020.     SUB    E
  1021.     LD    L,A
  1022.     LD    A,H
  1023.     SBC    A,D
  1024.     LD    H,A
  1025.     JR    C,WNDD2-$     ;jump if < 0
  1026.     INC    C          ;c = c + 1
  1027.     JR    WNDD1-$          ;loop
  1028.  
  1029. WNDD2:    ADD    HL,DE          ;hl = hl + de
  1030.     LD    A,C          ;jump if c non-zero
  1031.     OR    C
  1032.     JR    NZ,WNDD4-$
  1033.     LD    A,B          ;jump if digit written
  1034.     OR    B
  1035.     JR    NZ,WNDD4-$
  1036.     LD    A,' '          ;write one space
  1037.     JR    WACC-$
  1038.  
  1039. WNDD4:    LD    B,1          ;set 'digit written' flag
  1040.     LD    A,C          ;encode c into decimal
  1041.                   ; ascii
  1042.     ADD    A,'0'
  1043.     JR    WACC-$          ;go write it
  1044.  
  1045. ;*  wacc - write ascii character to console  *
  1046.  
  1047. WACC:    PUSH    HL
  1048.     PUSH    DE
  1049.     PUSH    BC
  1050.     PUSH    AF
  1051.  
  1052.     LD    C,WCFC
  1053.     LD    E,A
  1054.     CALL    ENTRY
  1055.  
  1056.     POP    AF
  1057.     POP    BC
  1058.     POP    DE
  1059.     POP    HL
  1060.     RET
  1061.  
  1062. ;*  racc - read ascii character from console  *
  1063.  
  1064. RACC:    PUSH    HL
  1065.     PUSH    DE
  1066.     PUSH    BC
  1067.  
  1068.     LD    C,RCFC
  1069.     CALL    ENTRY
  1070.  
  1071.     POP    BC
  1072.     POP    DE
  1073.     POP    HL
  1074.     RET
  1075.  
  1076. ;*  reset - reset disk system  *
  1077.  
  1078. RESET:    PUSH    HL
  1079.     PUSH    DE
  1080.     PUSH    BC
  1081.  
  1082.     LD    C,RDFC
  1083.     CALL    ENTRY
  1084.  
  1085.     POP    BC
  1086.     POP    DE
  1087.     POP    HL
  1088.     RET
  1089.  
  1090. ;*  open - open disk file  *
  1091.  
  1092. OPEN:    PUSH    HL
  1093.     PUSH    DE
  1094.     PUSH    BC
  1095.  
  1096.     LD    DE,TFCB
  1097.     LD    C,OFFC
  1098.     CALL    ENTRY
  1099.  
  1100.     POP    BC
  1101.     POP    DE
  1102.     POP    HL
  1103.     RET
  1104.  
  1105. ;*  read - read record from disk file  *
  1106.  
  1107. READ:    PUSH    HL
  1108.     PUSH    DE
  1109.     PUSH    BC
  1110.  
  1111.     LD    DE,TFCB
  1112.     LD    C,RRFC
  1113.     CALL    ENTRY
  1114.  
  1115.     POP    BC
  1116.     POP    DE
  1117.     POP    HL
  1118.     RET
  1119.  
  1120. ;*  close - close disk file  *
  1121.  
  1122. CLOSE:    PUSH    HL
  1123.     PUSH    DE
  1124.     PUSH    BC
  1125.  
  1126.     LD    DE,TFCB
  1127.     LD    C,CFFC
  1128.     CALL    ENTRY
  1129.  
  1130.     POP    BC
  1131.     POP    DE
  1132.     POP    HL
  1133.     RET
  1134.  
  1135. ;*  delt - delete disk file  *
  1136.  
  1137. DELT:    PUSH    HL
  1138.     PUSH    DE
  1139.     PUSH    BC
  1140.  
  1141.     LD    DE,TFCB
  1142.     LD    C,DFFC
  1143.     CALL    ENTRY
  1144.  
  1145.     POP    BC
  1146.     POP    DE
  1147.     POP    HL
  1148.     RET
  1149.  
  1150. ;*  make - make new disk file  *
  1151.  
  1152. MAKE:    PUSH    HL
  1153.     PUSH    DE
  1154.     PUSH    BC
  1155.  
  1156.     LD    DE,TFCB
  1157.     LD    C,MFFC
  1158.     CALL    ENTRY
  1159.  
  1160.     POP    BC
  1161.     POP    DE
  1162.     POP    HL
  1163.     RET
  1164.  
  1165. ;*  write - write record to file  *
  1166.  
  1167. WRITE:    PUSH    HL
  1168.     PUSH    DE
  1169.     PUSH    BC
  1170.  
  1171. ;*  REVISION 4.3 MODS  *
  1172.  
  1173.     LD    A,(TFCB+NR)   ;LAST RECORD IN EXTENT?
  1174.     CP    7FH
  1175.     JR    NZ,WRITE1-$   ;NO, CONTINUE
  1176.     LD    HL,(MBUFP)    ;EXISTING DATA AREA
  1177.     LD    DE,DBUF          ;POINT TO SAFE AREA
  1178.     CALL    SETDMA          ;FROM HERE
  1179.     LD    BC,80H          ;LENGTH TO MOVE
  1180.     LDIR              ;MOVE DATA AWAY SO...
  1181.  
  1182. ;*  CP/M DOESN'T OVERWRITE THE REAL DATA IN OPENING   *
  1183. ;*  NEXT EXTENT                          *
  1184.  
  1185. ;*  END REVISION 4.3 MODS  *
  1186.  
  1187. WRITE1: LD    DE,TFCB
  1188.     LD    C,WRFC
  1189.     CALL    ENTRY
  1190.  
  1191.     POP    BC
  1192.     POP    DE
  1193.     POP    HL
  1194.     RET
  1195.  
  1196. ;*  setdma - set dma address  *
  1197.  
  1198. SETDMA: PUSH    HL
  1199.     PUSH    DE
  1200.     PUSH    BC
  1201.  
  1202.     LD    C,SAFC
  1203.     CALL    ENTRY
  1204.  
  1205.     POP    BC
  1206.     POP    DE
  1207.     POP    HL
  1208.     RET
  1209.  
  1210. ;*  srchf - search for first occurance of afn  *
  1211.  
  1212. SRCHF:    PUSH    HL
  1213.     PUSH    DE
  1214.     PUSH    BC
  1215.  
  1216.     LD    C,SFFC
  1217.     CALL    ENTRY
  1218.  
  1219.     POP    BC
  1220.     POP    DE
  1221.     POP    HL
  1222.     RET
  1223.  
  1224. ;*  srchn - search for next occurance of afn  *
  1225.  
  1226. SRCHN:    PUSH    HL
  1227.     PUSH    DE
  1228.     PUSH    BC
  1229.  
  1230.     LD    C,SNFC
  1231.     CALL    ENTRY
  1232.  
  1233.     POP    BC
  1234.     POP    DE
  1235.     POP    HL
  1236.     RET
  1237.  
  1238.  
  1239. ;*  mesages here  *
  1240.  
  1241.  
  1242. MSG1:    DB    CR,LF
  1243.     DB    'MFT V'
  1244.     DB    VERSION+'0'   ;VERSION #
  1245.     DB    '.'
  1246.     DB    MODLEV+'0'    ;MODIFICATION LEVEL
  1247.     DB    CR,LF
  1248.     DB    'Multi-File-Transfer for single '
  1249.     DB    'disk,'
  1250.     DB    CR,LF
  1251.     DB    'With multiple-copy option.'
  1252.     DB    CR,LF,LF
  1253.     DB    0
  1254.  
  1255. MSG2:    DB    'Buffer size = '
  1256.     DB    0
  1257.  
  1258. MSG3:    DB    ' sectors.'
  1259.     DB    CR,LF,LF
  1260.     DB    0
  1261.  
  1262. MSG4:    DB    'Mount INPUT disk, type RETURN (or ^C '
  1263.     DB    'to reboot)...'
  1264.     DB    0
  1265.  
  1266. MSG5:    DB    '-- Syntax error in filename --'
  1267.     DB    CR,LF
  1268.     DB    0
  1269.  
  1270. MSG6:    DB    ' - '
  1271.     DB    0
  1272.  
  1273. MSG7:    DB    ' not found !'
  1274.     DB    CR,LF
  1275.     DB    0
  1276.  
  1277. MSG8:    DB    'read error - '
  1278.     DB    0
  1279.  
  1280. MSG9:    DB    ' sectors read.'
  1281.     DB    CR,LF
  1282.     DB    0
  1283. MSGA:    DB    'Mount OUTPUT disk, type RETURN (or '
  1284.     DB    '^C to reboot)...'
  1285.     DB    0
  1286.  
  1287. MSGB:    DB    '-- unable to create --'
  1288.     DB    CR,LF
  1289.     DB    0
  1290.  
  1291. MSGC:    DB    '-- error writing file --'
  1292.     DB    CR,LF
  1293.     DB    0
  1294.  
  1295. MSGD:    DB    '-- unable to close --'
  1296.     DB    CR,LF
  1297.     DB    0
  1298.  
  1299. MSGE:    DB    ' sectors written.'
  1300.     DB    CR,LF
  1301.     DB    0
  1302.  
  1303. MSGF:    DB    CR,LF
  1304.     DB    'Completed. '
  1305.     DB    'Type RETURN for another copy, OR...'
  1306.     DB    0
  1307.  
  1308. MSGG:    DB    CR,LF
  1309.     DB    'Type ^C to reboot.'
  1310.     DB    CR,LF
  1311.     DB    0
  1312.  
  1313. MSGH:    DB    CR,LF
  1314.     DB    '++ Memory buffer exceeded, cannot '
  1315.     DB    CR,LF
  1316.     DB    'make duplicate copies this time ; '
  1317.     DB    CR,LF
  1318.     DB    'last ouput file is defective ++'
  1319.     DB    CR,LF,LF
  1320.     DB    0
  1321.  
  1322. MSGJ:    DB    CR,LF
  1323.     DB    '++ PROGRAM ABORTED ++'
  1324.     DB    CR,LF
  1325.     DB    0
  1326.  
  1327. MSGK:    DB    CR,LF
  1328.     DB    '-- No file name specified --'
  1329.     DB    CR,LF
  1330.     DB    0
  1331.  
  1332. MSGL:    DB    'exists. Erase it (Y/N) ? '
  1333.     DB    0
  1334.  
  1335. FILERO: DB    'is a R/O file. Confirm erasure '
  1336.     DB    '(Y/N) ? '
  1337.     DB    0
  1338.  
  1339. BADVER: DB    'Sorry, you need CP/M version 2.0 or '
  1340.     DB    'higher.'
  1341.     DB    CR,LF
  1342.     DB    0
  1343.  
  1344. REOPER: DB    '-- Reopen error , insert correct '
  1345.     DB    'output disk next time --'
  1346.     DB    CR,LF
  1347.     DB    0
  1348.  
  1349.  
  1350. ZEROS:    DB    0,0,0,0
  1351.  
  1352.  
  1353.     ORG    ($+15)/16*16
  1354.  
  1355.  
  1356. FNT:    DEFS    16*128+1      ;changed fnt entries from
  1357.                   ;64 to 128 !!
  1358.  
  1359. STACK:    DEFS    64
  1360. SPACE:    DEFS    2          ;available space
  1361. MSIZE:    DEFS    2          ;memory size
  1362. CBUF:    DEFS    80          ;command buffer
  1363. CBUFP:    DEFS    2          ;command buffer pointer
  1364. FSIZE:    DEFS    2          ;file size in sectors
  1365. XSIZE:    DEFS    2          ;file size for printout
  1366. IFNTP:    DEFS    2          ;input fnt pointer
  1367. OFNTP:    DEFS    2          ;output fnt pointer
  1368. MBUFP:    DEFS    2          ;memory buffer pointer
  1369. IFCB:    DEFS    33          ;input fcb
  1370. OFCB:    DEFS    33          ;output fcb
  1371. XFCB:    DEFS    33          ;temporary fcb
  1372. IBFLG:    DEFS    1          ;input break flag
  1373. OBFLG:    DEFS    1          ;output break flag
  1374. NDFLG:    DEFS    1          ;NO DUPLICATE ALLOWED
  1375.                   ; FLAG
  1376. SAVE:    DEFS    1          ;temp. store of directory
  1377.                   ;pointer in erase routine
  1378. NERAS:    DEFS    1          ;last output file not
  1379.                   ;written to disk flag !
  1380.  
  1381.  
  1382. MBUF:    EQU    $
  1383.  
  1384.  
  1385.     END    MFT
  1386.  
  1387.  
  1388. ;******************************************************
  1389. ;*                              *
  1390. ;* Explanation as to structure of entries in the FNT  *
  1391. ;* -------------------------------------------------  *
  1392. ;*                              *
  1393. ;*     -------------------------------------          *
  1394. ;*     |00|01|02|..|..|..|10|11|12|13|14|15|          *
  1395. ;*     -------------------------------------          *
  1396. ;*                              *
  1397. ;* 00     = read done flag ; set to 1 if this name has *
  1398. ;*                already been read in.     *
  1399. ;*                              *
  1400. ;* 01-08 = filename.                      *
  1401. ;*                              *
  1402. ;* 09-11 = filetype.                      *
  1403. ;*                              *
  1404. ;* 12-13 = start address of data for this file.          *
  1405. ;*                              *
  1406. ;* 14-15 = length of file in 128 byte sectors.          *
  1407. ;*                              *
  1408. ;* Note : 00-15 are offset from start of FNT entry.   *
  1409. ;*                              *
  1410. ;******************************************************
  1411.