-
Notifications
You must be signed in to change notification settings - Fork 84
/
verdir
113 lines (113 loc) · 1.77 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
.PAGE 'VER-DIR'
; VALIDATE FILES WITH BAM
; CREATE NEW BAM ACCORDING TO
; CONTENTS OF FILES ENTERED IN DIR
.SKIP
VERDIR
VALDAT JSR SIMPRS ;EXTRACT DRIVE #
JSR INITDR ;INIT THE DRIVE FOR NAME, ID
JSR NEWMPV ;SET NEW BAM
LDA #0
STA DELIND
JSR SRCHST ;SEARCH FOR FIRST FILE
BNE VD25 ;FOUND ONE
.SKIP
VD10 LDA #0 ;SET DIRECTORY SECTORS...
STA SECTOR ;...IN BAM
LDA #18
STA TRACK
JSR MRKBAM
LDA DRVNUM
JSR MO10 ;WRITE OUT BAM
JMP ENDCMD
.SKIP
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 MRKBAM ;VALIDATE SS BY LINKS
VD17 PLA
STA SECTOR ;NOW DO DATA BLOCKS
PLA
STA TRACK
JSR MRKBAM ;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
.SKIP
MRKBAM ;MARK BAM WITH FILE SECTORS
JSR SETBMP
JSR USEDTS
JSR OPNIRD
MRK2 LDA #0
JSR SETPNT
JSR GETBYT
STA TRACK
JSR GETBYT
STA SECTOR
LDA TRACK
BNE MRK1
JMP FRECHN
MRK1 JSR USEDTS
JSR NXTBUF
JMP MRK2
.SKIP
; SET NEW BAM, CALLED BY VERDIR
NEWMPV
JSR SETBMP
NEWMAP
LDY #0
LDA #18 ;SET LINK TO 18.1
STA (BMPNT),Y
INY
TYA
STA (BMPNT),Y
INY
INY
INY ;.Y=4
NM10
LDA #0 ;CLEAR TRACK MAP
STA T0
STA T1
STA T2
;
TYA
LSR A
LSR A ;.A=TRACK #
JSR MAXSEC
STA (BMPNT),Y
INY
TAX
NM20
SEC ;SET MAP BITS
ROL T0
ROL T1
ROL T2
DEX
BNE NM20
NM30 ;.X=0
LDA T0,X
STA (BMPNT),Y
INY
INX
CPX #3
BCC NM30
CPY #$90 ;END OF BAM
BCC NM10
RTS
;
.END