-
Notifications
You must be signed in to change notification settings - Fork 82
/
close
224 lines (224 loc) · 2.98 KB
/
close
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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
.PAGE 'CLOSE'
; CLOSE THE FILE ASSOCIATED WITH SA
;
CLOSE
LDA #0
STA WBAM
LDA SA
BNE CLS10 ; DIRECTORY CLOSE
LDA #0
STA DIRLST ;CLEAR DIR LIST
JSR FRECHN
CLS05
JMP FREICH
CLS10
CMP #$F
BEQ CLSALL ; CLOSE CMD CHANL
JSR CLSCHN ;CLOSE CHANNEL
LDA SA
CMP #2
BCC CLS05
;
LDA ERWORD
BNE CLS15 ; LAST COMMAND HAD AN ERROR
JMP ENDCMD
CLS15
JMP SCREN1
;
CLSALL
LDA #14
STA SA
CLS20
JSR CLSCHN
DEC SA
BPL CLS20
LDA ERWORD
BNE CLS25 ; LAST COMMAND HAD AN ERROR
JMP ENDCMD
CLS25
JMP SCREN1
;
CLSCHN
LDX SA
LDA LINTAB,X
CMP #$FF
BNE CLSC28
RTS
CLSC28
AND #$F
STA LINDX
;
JSR TYPFIL
CMP #DIRTYP
BEQ CLSC30 ;DIRECT CHANNEL
CMP #RELTYP
BEQ CLSREL
;
JSR FNDWCH ;LOOK FOR WRITE CHANNEL
BCS CLSC31
;
JSR CLSWRT ;CLOSE SEQ WRITE
JSR CLSDIR ;CLOSE DIRECTORY
CLSC30
JSR MAPOUT ;WRITE BAM
CLSC31
JMP FRECHN
;
CLSREL
JSR SCRUB
JSR DBLBUF
JSR SSEND
LDX SSNUM
STX T4
INC T4
LDA #0
STA T1
STA T2
LDA SSIND
SEC
SBC #SSIOFF-2
STA T3
JSR SSCALC
LDX LINDX
LDA T1
STA NBKL,X
LDA T2
STA NBKH,X
LDA #DYFILE
JSR TSTFLG
BEQ CLSR1
JSR CLSDIR
CLSR1 JMP FRECHN
;
; CLOSE A WRITE CHANL
;
CLSWRT ;CLOSE SEQ WRITE FILE
LDX LINDX
LDA NBKL,X
ORA NBKH,X
BNE CLSW10 ;AT LEAST 1 BLOCK WRITTEN
;
JSR GETPNT
CMP #2
BNE CLSW10 ;AT LEAST 1 BYTE WRITTEN
;
LDA #CR
JSR PUTBYT
CLSW10
JSR GETPNT
CMP #2
BNE CLSW20 ;NOT MT BUFFER
;
JSR DBLBUF ;SWITCH BUFS
;
LDX LINDX
LDA NBKL,X
BNE CLSW15
DEC NBKH,X
CLSW15
DEC NBKL,X
;
LDA #0
CLSW20
SEC
SBC #1 ;BACK UP 1
PHA ;SAVE IT
LDA #0
JSR SETPNT
JSR PUTBYT ;TLINK=0
PLA ;LSTCHR COUNT
JSR PUTBYT
;
JSR WRTBUF ;WRITE OUT LAST BUFFER
JSR WATJOB ;FINISH JOB UP
JMP DBLBUF ;MAKE SURE BOTH BUFS OK
;RTS
;
; DIRECTORY CLOSE ON OPEN WRITE FILE
;
CLSDIR LDX LINDX ;SAVE LINDX
STX WLINDX ;&SA
LDA SA
PHA
LDA DSEC,X ;GET DIRECTORY SECTOR
STA SECTOR
LDA DIND,X ;GET SECTOR OFFSET
STA INDEX
LDA FILTYP,X ;DRV # IN FILTYP
AND #1
STA DRVNUM
LDA DIRTRK
STA TRACK
JSR GETACT ;ALLOCATE A BUFFER
PHA
STA JOBNUM
JSR DRTRD ;READ DIRECTORY SECTOR
LDY #0
LDA BUFIND,X ;.X IS JOB#
STA R0+1
LDA INDEX
STA R0
LDA (R0),Y
AND #$20
BEQ CLSD5
JSR TYPFIL
CMP #RELTYP
BEQ CLSD6
;
LDA (R0),Y
AND #$8F ;REPLACE FILE
STA (R0),Y
INY
LDA (R0),Y
STA TRACK
STY TEMP+2
LDY #27 ;EXTRACT REPLACEMENT LINK
LDA (R0),Y ; TO LAST SECTOR
PHA
DEY
LDA (R0),Y
BNE CLSD4
STA TRACK
PLA
STA SECTOR
LDA #$67
JSR CMDER2
CLSD4
PHA
LDA #0
STA (R0)Y
INY
STA (R0)Y
PLA
LDY TEMP+2
STA (R0),Y
INY
LDA (R0),Y
STA SECTOR
PLA
STA (R0),Y
JSR DELFIL ;DELETE OLD FILE
JMP CLSD6 ;SET CLOSE BIT
CLSD5
LDA (R0),Y
AND #$F
ORA #$80
STA (R0),Y
CLSD6 LDX WLINDX
LDY #28 ;SET # OF BLOCKS
LDA NBKL,X
STA (R0),Y
INY
LDA NBKH,X
STA (R0),Y
PLA
TAX
LDA #WRITE ;WRITE DIRECTORY SECTOR
ORA DRVNUM
JSR DOIT
PLA
STA SA
JMP FNDWCH ;RESTORE LINDX
;
;
.END