You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

231 lines
2.8KB

  1. .PAGE 'COPY'
  2. ; COPY FILE(S) TO ONE FILE
  3. ;
  4. COPY ;FILENAMES, OPTIMIZE
  5. JSR LOOKUP ;LOOK IP ALL FILES
  6. LDA F2CNT
  7. CMP #3
  8. BCC COP10
  9. ;
  10. LDA FILDRV
  11. CMP FILDRV+1
  12. BNE COP10
  13. ;
  14. LDA ENTIND
  15. CMP ENTIND+1
  16. BNE COP10
  17. ;
  18. LDA ENTSEC
  19. CMP ENTSEC+1
  20. BNE COP10
  21. ;
  22. JSR CHKIN ;CONCAT
  23. LDA #1
  24. STA F2PTR
  25. JSR OPIRFL
  26. ;
  27. JSR TYPFIL
  28. BEQ COP01
  29. CMP #PRGTYP
  30. BNE COP05
  31. COP01
  32. LDA #MISTYP
  33. JSR CMDERR
  34. COP05
  35. LDA #IWSA
  36. STA SA
  37. LDA LINTAB+IRSA
  38. STA LINTAB+IWSA
  39. LDA #$FF
  40. STA LINTAB+IRSA
  41. JSR APPEND
  42. LDX #2
  43. JSR CY10
  44. JMP ENDCMD
  45. COP10
  46. JSR CY
  47. JMP ENDCMD
  48. ;
  49. ;
  50. CY
  51. JSR CHKIO ;CHECK FILES FOR EXISTENCE
  52. .SKIP
  53. LDA FILDRV
  54. AND #1
  55. STA DRVNUM
  56. JSR OPNIWR ;OPEN INTERNAL WRITE CHNL
  57. JSR ADDFIL ;ADD TO DIRECTORY
  58. LDX F1CNT
  59. .SKIP
  60. CY10 STX F2PTR ;SET UP READ FILE
  61. JSR OPIRFL
  62. ;
  63. LDA #IRSA ;ADD FOR REL COPY
  64. STA SA
  65. JSR FNDRCH
  66. JSR TYPFIL
  67. BNE CY10A ;NOT REL
  68. JSR CYEXT
  69. ;
  70. CY10A LDA #EOISND
  71. STA EOIFLG
  72. JMP CY20
  73. CY15
  74. JSR PIBYTE
  75. CY20
  76. JSR GIBYTE
  77. LDA #LRF
  78. JSR TSTFLG
  79. BEQ CY15
  80. ;
  81. JSR TYPFIL
  82. BEQ CY30
  83. ;
  84. JSR PIBYTE
  85. CY30
  86. LDX F2PTR
  87. ;
  88. INX
  89. CPX F2CNT
  90. BCC CY10 ;MORE FILES TO COPY
  91. LDA #IWSA
  92. STA SA
  93. JMP CLSCHN ;CLOSE COPY CHANNEL, FILE
  94. ;
  95. OPIRFL
  96. LDX F2PTR
  97. LDA FILDRV,X
  98. AND #1
  99. STA DRVNUM
  100. LDA DIRTRK
  101. STA TRACK
  102. LDA ENTSEC,X
  103. STA SECTOR
  104. JSR OPNIRD
  105. LDX F2PTR
  106. LDA ENTIND,X
  107. JSR SETPNT
  108. LDX F2PTR
  109. LDA PATTYP,X
  110. AND #TYPMSK
  111. STA TYPE
  112. ;
  113. LDA #0
  114. STA REC
  115. JSR OPREAD
  116. LDY #1
  117. JSR TYPFIL
  118. BEQ OPIR10
  119. INY
  120. OPIR10
  121. TYA
  122. JMP SETPNT
  123. ;
  124. GIBYTE
  125. LDA #IRSA
  126. STA SA
  127. GCBYTE
  128. JSR GBYTE
  129. ;
  130. STA DATA
  131. LDX LINDX
  132. LDA CHNRDY,X
  133. AND #EOISND
  134. STA EOIFLG
  135. BNE GIB20
  136. ;
  137. JSR TYPFIL
  138. BEQ GIB20
  139. ;
  140. LDA #LRF
  141. JSR SETFLG
  142. GIB20 RTS
  143. ;
  144. CYEXT JSR SETDRN ;COPY REL RECORDS
  145. JSR SSEND
  146. LDA SSIND
  147. PHA
  148. LDA SSNUM
  149. PHA
  150. LDA #IWSA
  151. STA SA
  152. JSR FNDWCH
  153. JSR SETDRN
  154. JSR SSEND
  155. JSR POSBUF
  156. LDA SSIND
  157. STA R1
  158. LDA SSNUM
  159. STA R0
  160. LDA #0
  161. STA R2
  162. STA RECPTR
  163. STA RELPTR
  164. PLA
  165. STA SSNUM
  166. PLA
  167. STA SSIND
  168. JMP ADDR1
  169. ;
  170. .PAGE 'RENAME'
  171. ; RENAME FILE NAME IN DIRECTORY
  172. RENAME JSR ALLDRS ;SET BOTH DRIVE #'S
  173. LDA FILDRV+1
  174. AND #1
  175. STA FILDRV+1
  176. CMP FILDRV
  177. BEQ RN10 ;SAME DRIVE #'S
  178. ORA #$80 ;CHECK BOTH DRIVES FOR NAME
  179. RN10 STA FILDRV
  180. JSR LOOKUP ;LOOK UP BOTH NAMES
  181. JSR CHKIO ;CHECK FOR EXISTENCE
  182. LDA FILDRV+1
  183. AND #1
  184. STA DRVNUM
  185. LDA ENTSEC+1
  186. STA SECTOR
  187. JSR RDAB ;READ DIRECTORY SECTOR
  188. JSR WATJOB
  189. LDA ENTIND+1
  190. CLC ;SET SECTOR INDEX
  191. ADC #3 ;...+3
  192. JSR SETPNT
  193. JSR GETACT
  194. TAY
  195. LDX FILTBL
  196. LDA #16
  197. JSR TRNAME ;TRANSFER NAME
  198. JSR WRTOUT ;WRITE SECTOR OUT
  199. JSR WATJOB
  200. JMP ENDCMD
  201. .SKIP
  202. .SKIP
  203. ; CHECK I/O FILE FOR EXIST
  204. CHKIN
  205. LDA PATTYP+1 ;1ST FILE BEARS TYPE
  206. AND #TYPMSK
  207. STA TYPE
  208. ;
  209. LDX F2CNT
  210. CK10 DEX
  211. CPX F1CNT
  212. BCC CK20
  213. LDA FILTRK,X
  214. BNE CK10
  215. LDA #FLNTFD ;INPUT FILE NOT FOUND
  216. JMP CMDERR
  217. CK20
  218. RTS
  219. ;
  220. CHKIO
  221. JSR CHKIN
  222. CK25 LDA FILTRK,X
  223. BEQ CK30
  224. LDA #FLEXST
  225. JMP CMDERR
  226. CK30 DEX
  227. BPL CK25
  228. RTS
  229. .SKIP
  230. .END