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.

trnsfr.src 5.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254
  1. .page 'transfer'
  2. ;transfer filename from cmd to buffer
  3. ; a: string size
  4. ; x: starting index in cmdbuf
  5. ; y: buffer #
  6. trname pha
  7. jsr fndlmt
  8. jsr trcmbf
  9. pla
  10. sec
  11. sbc strsiz
  12. tax
  13. beq tn20
  14. bcc tn20
  15. lda #$a0
  16. tn10 sta (dirbuf),y
  17. iny
  18. dex
  19. bne tn10
  20. tn20 rts
  21. ;transfer cmd buffer to other buffer
  22. ; uses current buffer ptr
  23. ; limit: ending index+1 in cmd buf
  24. ; x: starting index in cmd buf
  25. ; y: buffer #
  26. trcmbf tya
  27. asl a
  28. tay
  29. lda buftab,y
  30. sta dirbuf
  31. lda buftab+1,y
  32. sta dirbuf+1
  33. ldy #0
  34. ;
  35. tr10 lda cmdbuf,x
  36. sta (dirbuf),y
  37. iny
  38. beq tr20
  39. inx
  40. cpx limit
  41. bcc tr10
  42. tr20 rts
  43. ;
  44. ;
  45. ;find the limit of the string in cmdbuf
  46. ; pointed to by x
  47. fndlmt lda #0
  48. sta strsiz
  49. txa
  50. pha
  51. fl05
  52. lda cmdbuf,x
  53. cmp #',
  54. beq fl10
  55. cmp #'=
  56. beq fl10
  57. inc strsiz
  58. inx
  59. lda #15
  60. cmp strsiz
  61. bcc fl10
  62. cpx cmdsiz
  63. bcc fl05
  64. fl10 stx limit
  65. pla
  66. tax
  67. rts
  68. .page 'trnsfr-getnam'
  69. ; get file entry from directory
  70. ; called by stdir, getdir
  71. getnam lda sa ; save variables
  72. pha
  73. lda lindx
  74. pha
  75. jsr gnsub
  76. pla ; restore variables
  77. sta lindx
  78. pla
  79. sta sa
  80. rts
  81. gnsub lda #irsa
  82. sta sa
  83. jsr fndrch
  84. jsr getpnt
  85. lda entfnd
  86. bpl gn05 ; more files
  87. lda drvflg
  88. bne gn050
  89. jsr msgfre ; send blocks free
  90. clc ; (c=0): end
  91. rts ; terminate
  92. gn05 lda drvflg ; (drvflg=0):
  93. beq gn10 ; send file name
  94. gn050
  95. dec drvflg ; (drvflg=-1):new dir
  96. bne gn051
  97. dec drvflg ; (drvflg=-1):
  98. jsr togdrv ; send blocks free
  99. jsr msgfre
  100. sec
  101. jmp togdrv
  102. gn051 lda #0
  103. sta nbtemp+1
  104. sta drvflg ; reset flag
  105. jsr newdir
  106. sec
  107. rts
  108. gn10 ldx #dirlen ; set number blocks
  109. ldy #29 ; & adjust spacing
  110. lda (dirbuf),y
  111. sta nbtemp+1
  112. beq gn12
  113. ldx #dirlen-2
  114. gn12 dey
  115. lda (dirbuf),y
  116. sta nbtemp
  117. cpx #dirlen-2
  118. beq gn14
  119. cmp #10
  120. bcc gn14
  121. dex
  122. cmp #100
  123. bcc gn14
  124. dex
  125. gn14 jsr blknb ; clear name buffer
  126. lda (dirbuf),y ; set type chars
  127. pha
  128. asl a ; (used in bcs)
  129. bpl gn15
  130. lda #'<
  131. sta nambuf+1,x
  132. gn15
  133. pla
  134. and #$f
  135. tay
  136. lda tp2lst,y
  137. sta nambuf,x
  138. dex
  139. lda tp1lst,y
  140. sta nambuf,x
  141. dex
  142. lda typlst,y
  143. sta nambuf,x
  144. dex
  145. dex
  146. bcs gn20 ; (from asl)
  147. lda #'* ; file not closed
  148. sta nambuf+1,x
  149. gn20 lda #$a0
  150. sta nambuf,x
  151. dex
  152. ldy #18
  153. gn22 lda (dirbuf),y
  154. sta nambuf,x
  155. dex
  156. dey
  157. cpy #3
  158. bcs gn22
  159. lda #'" ; send name in quotes
  160. sta nambuf,x
  161. gn30 inx
  162. cpx #$20
  163. bcs gn35
  164. lda nambuf,x
  165. cmp #'"
  166. beq gn35
  167. cmp #$a0
  168. bne gn30
  169. gn35 lda #'"
  170. sta nambuf,x
  171. gn37 inx
  172. cpx #$20
  173. bcs gn40
  174. lda #$7f
  175. and nambuf,x
  176. sta nambuf,x
  177. bpl gn37
  178. gn40 jsr fndfil
  179. sec
  180. gn45 rts
  181. blknb ldy #nbsiz ; blank nambuf
  182. lda #$20
  183. blknb1 sta nambuf-1,y
  184. dey
  185. bne blknb1
  186. rts
  187. ;new directory in listing
  188. newdir
  189. jsr bam2x
  190. jsr redbam
  191. jsr blknb
  192. lda #$ff
  193. sta temp
  194. ldx drvnum
  195. stx nbtemp
  196. lda #0
  197. sta nbtemp+1
  198. ldx jobnum
  199. lda bufind,x
  200. sta dirbuf+1
  201. lda dsknam
  202. sta dirbuf
  203. ldy #22
  204. nd10 lda (dirbuf),y
  205. cmp #$a0
  206. bne nd20
  207. lda #'1 ; version # 1
  208. .byte $2c
  209. nd15
  210. lda (dirbuf),y
  211. cmp #$a0
  212. bne nd20
  213. ;
  214. lda #$20
  215. nd20
  216. sta nambuf+2,y
  217. dey
  218. bpl nd15
  219. lda #$12
  220. sta nambuf
  221. lda #'"
  222. sta nambuf+1
  223. sta nambuf+18
  224. lda #$20
  225. sta nambuf+19
  226. rts
  227. msgfre jsr blknb
  228. ldy #msglen-1
  229. msg1 lda fremsg,y
  230. sta nambuf,y
  231. dey
  232. bpl msg1
  233. jmp numfre
  234. fremsg .byte 'BLOCKS FREE.'
  235. msglen =*-fremsg
  236. ;.end