-
Notifications
You must be signed in to change notification settings - Fork 85
/
verdir
172 lines (172 loc) · 2.75 KB
/
verdir
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
.PAGE 'VER-DIR'
;
; VALIDATE FILES WITH BAM
; CREATE NEW BAM ACCORDING TO
; CONTENTS OF FILES ENTERED IN DIR
;
VERDIR
VALDAT
JSR SIMPRS ; EXTRACT DRIVE #
JSR INITDR
JSR VSETB
LDX DRVNUM
STA NDBL,X ; .A = 0
STA NDBH,X ; CLEAR FOR NEW MAP
JSR NEWMPV ; SET NEW BAM
LDA #0
STA DELIND
JSR SRCHST ; SEARCH FOR FIRST FILE
BNE VD25 ; FOUND ONE
VD10
LDA #0 ; SET DIRECTORY SECTORS
STA SECTOR ; IN BAM
LDA DIRTRK
STA TRACK
JSR VMKBAM
LDA DRVNUM
JSR WTMAPS ; WRITE OUT BAMS
JMP ENDCMD
VD15
INY
LDA (DIRBUF),Y
PHA ; SAVE TRACK
INY
LDA (DIRBUF),Y
PHA ; SAVE SECTOR
LDY #19 ; GET SS TRACK
LDA (DIRBUF),Y ; IS THIS RELATIVE?
BEQ VD17 ; NO
STA TRACK ; YES, SAVE TRACK
INY
LDA (DIRBUF),Y ; GET SS SECTOR
STA SECTOR
JSR VMKBAM ; VALIDATE SS BY LINKS
VD17
PLA
STA SECTOR ; NOW DO DATA BLOCKS
PLA
STA TRACK
JSR VMKBAM ; SET BIT USED IN BAM
VD20
JSR SRRE ; SEARCH FOR MORE
BEQ VD10 ; NO MORE FILES
VD25
LDY #0
LDA (DIRBUF),Y
BMI VD15
JSR DELDIR ; NOT CLOSED DELETE DIR
JMP VD20
VMKBAM
JSR TSCHK
JSR VUSED
JSR OPNIRD
MRK2
LDA #0
JSR SETPNT
JSR GETBYT
STA TRACK
JSR GETBYT
STA SECTOR
LDA TRACK
BNE MRK1
JMP FRECHN
MRK1
JSR VUSED
JSR NXTBUF
JMP MRK2
;
; MARK TRACK, SECTOR AS USED
;
VUSED
LDA #>VBAMS-1
STA BMPNT+1
LDA #<VBAMS
STA BMPNT
LDY #HITRK
VU10
INC BMPNT+1
LDA DOS
BEQ VUSED1 ; 4040 BAM
LDA TRACK
CMP (BMPNT),Y
BCS VU10
VUSED1
JSR MBAM ; .Y = BAM INDEX
STY TEMP ; SAVE INDEX
JSR AVCK ; CHECK TRACK FOR MISMATCH BITS
LDA SECTOR ; .A = SECTOR/8
LSR A
LSR A
LSR A ; FOR WHICH OF THREE BYTES
SEC
ADC TEMP ; CALC INDEX
TAY
LDA SECTOR ; BIT IN THAT BYTE
AND #7
TAX
LDA (BMPNT),Y ; GET THE BYTE
AND BMASK,X ; TEST IT
BEQ USDERR ; USED, ERROR
LDA (BMPNT),Y ; GET BITS
EOR BMASK,X ; MARK SECTOR USED
STA (BMPNT),Y
LDY TEMP ; INDEX TO FREE SEC CNT
LDA (BMPNT),Y ; GET COUNT
SEC
SBC #1 ; DEC ONE (C = 0)
STA (BMPNT),Y ; SAVE IT
LDA TRACK
CMP DIRTRK
BEQ VU20
LDX DRVNUM
LDA NDBL,X
BNE VU15
DEC NDBH,X
VU15
DEC NDBL,X
VU20
RTS
USDERR
LDA #NOBLK
JSR CMDER2
.PAGE
VSETB
LDA #>VBAMS
STA BMPNT+1
LDA #<VBAMS
STA BMPNT
JMP CLRBAM
WTMAPS
LDA #0 ; START WITH 1ST BAM
STA R0
WM10
LDX R0
LDA VBMBUF,X
STA JOBNUM
ASL A
ASL A
ASL A
TAY
LDA BAMTRK+1,X ; CHECK HEADER OF BAMS
BNE WM20 ; NULL TERMINATES LIST
RTS
WM20
LDA BAMTRK,X ; SET HEADER OF BAMS
STA HDRS+2,Y
LDA BAMSEC,X
STA HDRS+3,Y
LDA DRVNUM
ASL A
TAX
LDA DSKID,X
STA HDRS,Y
LDA DSKID+1,X
STA HDRS+1,Y
INC R0
JSR DOWRIT ; WRITE IT OUT
JMP WM10
;
VBAMS = $1D00 ; IMAGE OF $1100
VBMBUF
.BYTE 0,1,2,3
.END