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

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