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