-
Notifications
You must be signed in to change notification settings - Fork 85
/
Copy pathaddfil
124 lines (124 loc) · 1.89 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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
.PAGE 'ADDFIL'
;
; ADD FILE TO DIRECTORY
;
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 FILDRV
AND #1
STA DRVNUM
LDX JOBNUM
EOR LSTJOB,X
LSR A
BCC AF08 ; SAME DRIVE AS REQUIRED
LDX #1
STX DELIND ; LOOK FOR DELETED ENTRY
JSR SRCHST
BEQ AF15 ; ALL FULL, NEW SECTOR
BNE AF20 ; FOUND ONE
AF08
LDA DELENT
BEQ AF10 ; DELETED ENTRY NOT LOCATED
LDA DELSEC
CMP SECTOR
BNE AF09 ; SECTOR IS NOT RESIDENT
LDA DELTRK
CMP TRACK
BEQ AF20 ; TRACK AND SECTOR ARE RESIDENT
AF09
LDA DELSEC
STA SECTOR
LDA DELTRK
STA TRACK
JSR DRTRD ; READ IN THE TRACK AND SECTOR
JMP AF20
AF10
LDA #1 ; FIND DELETED ENTRY
STA DELIND
JSR SEARCH
BNE AF20
AF15
JSR NXDRBK ; ALL FULL, NEW SECTOR
LDA SECTOR
STA DELSEC
LDA #$FF
STA DELENT
LDA TRACK
STA DELTRK
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
STA ENTSEC
STA DSEC,X
LDA DELTRK
STA ENTTRK
STA DTRK,X
LDA DELIND
STA ENTIND
STA DIND,X
LDA TYPE
STA PATTYP
LDA DRVNUM
STA FILDRV
RTS
.END