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.

addfil.src 2.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. .page 'addfil'
  2. ; add file to directory
  3. addfil lda sa ; save variables
  4. pha
  5. lda lindx
  6. pha
  7. lda sector
  8. pha
  9. lda track
  10. pha
  11. lda #irsa
  12. sta sa
  13. jsr curblk ; use last accessed search
  14. lda type
  15. pha
  16. lda fildrv
  17. and #1
  18. sta drvnum
  19. ldx jobnum
  20. eor lstjob,x
  21. lsr a
  22. bcc af08 ; same drive as required
  23. ldx #1
  24. stx delind ; look for deleted entry
  25. jsr srchst
  26. beq af15 ; all full, new sector
  27. bne af20 ; found one
  28. af08 lda delsec
  29. beq af10 ; deleted entry not located
  30. cmp sector
  31. beq af20 ; sector is resident
  32. sta sector
  33. jsr drtrd ; read sector in
  34. jmp af20
  35. af10 lda #1 ; find deleted entry
  36. sta delind
  37. jsr search
  38. bne af20
  39. af15 jsr nxdrbk ; all full, new sector
  40. lda sector
  41. sta delsec
  42. lda #2
  43. sta delind
  44. af20 lda delind
  45. jsr setpnt
  46. pla
  47. sta type ; set type
  48. cmp #reltyp
  49. bne af25
  50. ora #$80
  51. af25
  52. jsr putbyt
  53. pla
  54. sta filtrk ; ...table & entry
  55. jsr putbyt
  56. pla
  57. sta filsec ; set sector link in...
  58. jsr putbyt ; ...table & entry
  59. jsr getact
  60. tay
  61. lda filtbl
  62. tax
  63. lda #16
  64. jsr trname ; transfer name
  65. ldy #16
  66. lda #0 ; clear # of blocks &...
  67. af30 sta (dirbuf),y ; ...& replace links
  68. iny
  69. cpy #27
  70. bcc af30
  71. lda type ; a relative file ?
  72. cmp #reltyp
  73. bne af50 ; no
  74. ldy #16 ; yes
  75. lda trkss ; get ss track
  76. sta (dirbuf),y ; put in directory
  77. iny
  78. lda secss ; get ss sector
  79. sta (dirbuf),y ; put in
  80. iny
  81. lda rec ; get record size
  82. sta (dirbuf),y
  83. af50 jsr drtwrt ; write it out
  84. pla
  85. sta lindx
  86. tax
  87. pla
  88. sta sa
  89. lda delsec
  90. sta entsec
  91. sta dsec,x
  92. lda delind
  93. sta entind
  94. sta dind,x
  95. lda type
  96. sta pattyp
  97. lda drvnum
  98. sta fildrv
  99. rts
  100. ;
  101. ; .end