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 1.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. .PAGE 'ADDFIL'
  2. ;
  3. ; ADD FILE TO DIRECTORY
  4. ;
  5. ADDFIL
  6. LDA SA ; SAVE VARIABLES
  7. PHA
  8. LDA LINDX
  9. PHA
  10. LDA SECTOR
  11. PHA
  12. LDA TRACK
  13. PHA
  14. LDA #IRSA
  15. STA SA
  16. JSR CURBLK ; USE LAST ACCESSED SEARCH
  17. LDA TYPE
  18. PHA
  19. LDA FILDRV
  20. AND #1
  21. STA DRVNUM
  22. LDX JOBNUM
  23. EOR LSTJOB,X
  24. LSR A
  25. BCC AF08 ; SAME DRIVE AS REQUIRED
  26. LDX #1
  27. STX DELIND ; LOOK FOR DELETED ENTRY
  28. JSR SRCHST
  29. BEQ AF15 ; ALL FULL, NEW SECTOR
  30. BNE AF20 ; FOUND ONE
  31. AF08
  32. LDA DELENT
  33. BEQ AF10 ; DELETED ENTRY NOT LOCATED
  34. LDA DELSEC
  35. CMP SECTOR
  36. BNE AF09 ; SECTOR IS NOT RESIDENT
  37. LDA DELTRK
  38. CMP TRACK
  39. BEQ AF20 ; TRACK AND SECTOR ARE RESIDENT
  40. AF09
  41. LDA DELSEC
  42. STA SECTOR
  43. LDA DELTRK
  44. STA TRACK
  45. JSR DRTRD ; READ IN THE TRACK AND SECTOR
  46. JMP AF20
  47. AF10
  48. LDA #1 ; FIND DELETED ENTRY
  49. STA DELIND
  50. JSR SEARCH
  51. BNE AF20
  52. AF15
  53. JSR NXDRBK ; ALL FULL, NEW SECTOR
  54. LDA SECTOR
  55. STA DELSEC
  56. LDA #$FF
  57. STA DELENT
  58. LDA TRACK
  59. STA DELTRK
  60. LDA #2
  61. STA DELIND
  62. AF20
  63. LDA DELIND
  64. JSR SETPNT
  65. PLA
  66. STA TYPE ; SET TYPE
  67. CMP #RELTYP
  68. BNE AF25
  69. ORA #$80
  70. AF25
  71. JSR PUTBYT
  72. PLA
  73. STA FILTRK ; ...TABLE & ENTRY
  74. JSR PUTBYT
  75. PLA
  76. STA FILSEC ; SET SECTOR LINK IN...
  77. JSR PUTBYT ; ...TABLE & ENTRY
  78. JSR GETACT
  79. TAY
  80. LDA FILTBL
  81. TAX
  82. LDA #16
  83. JSR TRNAME ; TRANSFER NAME
  84. LDY #16
  85. LDA #0 ; CLEAR # OF BLOCKS &...
  86. AF30
  87. STA (DIRBUF),Y ; ...& REPLACE LINKS
  88. INY
  89. CPY #27
  90. BCC AF30
  91. LDA TYPE ; A RELATIVE FILE?
  92. CMP #RELTYP
  93. BNE AF50 ; NO
  94. LDY #16 ; YES
  95. LDA TRKSS ; GET SS TRACK
  96. STA (DIRBUF),Y ; PUT IN DIRECTORY
  97. INY
  98. LDA SECSS ; GET SS SECTOR
  99. STA (DIRBUF),Y ; PUT IN
  100. INY
  101. LDA REC ; GET RECORD SIZE
  102. STA (DIRBUF),Y
  103. AF50
  104. JSR DRTWRT ; WRITE IT OUT
  105. PLA
  106. STA LINDX
  107. TAX
  108. PLA
  109. STA SA
  110. LDA DELSEC
  111. STA ENTSEC
  112. STA DSEC,X
  113. LDA DELTRK
  114. STA ENTTRK
  115. STA DTRK,X
  116. LDA DELIND
  117. STA ENTIND
  118. STA DIND,X
  119. LDA TYPE
  120. STA PATTYP
  121. LDA DRVNUM
  122. STA FILDRV
  123. RTS
  124. .END