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.

rename.src 5.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  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. lda fildrv
  53. and #1
  54. sta drvnum
  55. jsr opniwr ; open internal write chnl
  56. jsr addfil ; add to directory
  57. ldx f1cnt
  58. cy10 stx f2ptr ; set up read file
  59. jsr opirfl
  60. ;
  61. lda #irsa ; add for rel copy
  62. sta sa
  63. jsr fndrch
  64. jsr typfil
  65. bne cy10a ; not rel
  66. jsr cyext
  67. ;
  68. cy10a lda #eoisnd
  69. sta eoiflg
  70. jmp cy20
  71. cy15
  72. jsr pibyte
  73. cy20
  74. jsr gibyte
  75. lda #lrf
  76. jsr tstflg
  77. beq cy15
  78. ;
  79. jsr typfil
  80. beq cy30
  81. ;
  82. jsr pibyte
  83. cy30
  84. ldx f2ptr
  85. ;
  86. inx
  87. cpx f2cnt
  88. bcc cy10 ; more files to copy
  89. lda #iwsa
  90. sta sa
  91. jmp clschn ; close copy channel, file
  92. ;
  93. opirfl
  94. ldx f2ptr
  95. lda fildrv,x
  96. and #1
  97. sta drvnum
  98. lda dirtrk
  99. sta track
  100. lda entsec,x
  101. sta sector
  102. jsr opnird
  103. ldx f2ptr
  104. lda entind,x
  105. jsr setpnt
  106. ldx f2ptr
  107. lda pattyp,x
  108. and #typmsk
  109. sta type
  110. ;
  111. lda #0
  112. sta rec
  113. jsr opread
  114. ldy #1
  115. jsr typfil
  116. beq opir10
  117. iny
  118. opir10
  119. tya
  120. jmp setpnt
  121. ;
  122. gibyte
  123. lda #irsa
  124. sta sa
  125. gcbyte
  126. jsr gbyte
  127. ;
  128. sta data
  129. ldx lindx
  130. lda chnrdy,x
  131. and #eoisnd
  132. sta eoiflg
  133. bne gib20
  134. ;
  135. jsr typfil
  136. beq gib20
  137. ;
  138. lda #lrf
  139. jsr setflg
  140. gib20 rts
  141. ;
  142. cyext jsr setdrn ; copy rel records
  143. jsr ssend
  144. lda ssind
  145. pha
  146. lda ssnum
  147. pha
  148. lda #iwsa
  149. sta sa
  150. jsr fndwch
  151. jsr setdrn
  152. jsr ssend
  153. jsr posbuf
  154. lda ssind
  155. sta r1
  156. lda ssnum
  157. sta r0
  158. lda #0
  159. sta r2
  160. sta recptr
  161. sta relptr
  162. pla
  163. sta ssnum
  164. pla
  165. sta ssind
  166. jmp addr1
  167. ;
  168. .page 'rename'
  169. ; rename file name in directory
  170. rename jsr alldrs ; set both drive #'s
  171. lda fildrv+1
  172. and #1
  173. sta fildrv+1
  174. cmp fildrv
  175. beq rn10 ; same drive #'s
  176. ora #$80 ; check both drives for name
  177. rn10 sta fildrv
  178. jsr lookup ; look up both names
  179. jsr chkio ; check for existence
  180. lda fildrv+1
  181. and #1
  182. sta drvnum
  183. lda entsec+1
  184. sta sector
  185. jsr rdab ; read directory sector
  186. jsr watjob
  187. lda entind+1
  188. clc ; set sector index
  189. adc #3 ; ...+3
  190. jsr setpnt
  191. jsr getact
  192. tay
  193. ldx filtbl
  194. lda #16
  195. jsr trname ; transfer name
  196. jsr wrtout ; write sector out
  197. jsr watjob
  198. jmp endcmd
  199. ; check i/o file for exist
  200. chkin
  201. lda pattyp+1 ; 1st file bears type
  202. and #typmsk
  203. sta type
  204. ;
  205. ldx f2cnt
  206. ck10 dex
  207. cpx f1cnt
  208. bcc ck20
  209. lda filtrk,x
  210. bne ck10
  211. lda #flntfd ; input file not found
  212. jmp cmderr
  213. ck20
  214. rts
  215. ;
  216. chkio
  217. jsr chkin
  218. ck25 lda filtrk,x
  219. beq ck30
  220. lda #flexst
  221. jmp cmderr
  222. ck30 dex
  223. bpl ck25
  224. rts
  225. ; .end