-
-
Notifications
You must be signed in to change notification settings - Fork 35
/
DRVINFO.MAC
260 lines (208 loc) · 3.42 KB
/
DRVINFO.MAC
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
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
.z80
jp START
; -------------------------------------------------------------------------------
db 13
db "DRVINFO - displays information about the driver and drive/device/LUN",13,10
db "for all drive letters",13,10
db 13,10
db "Usage: DRVINFO",13,10
db 1Ah
START:
call CHK250##
xor a
ld (DRVINDEX),a
;--- Loop for all drive letters
MAIN_LOOP:
ld a,(DRVINDEX)
ld hl,BUF_LETTER
ld c,_GDLI##
call 5
ld b,a
ld c,_TERM##
jp nz,5
;* Skip if unassigned drive
ld a,(BUF_LETTER)
or a
jp z,NEXT_DRIVE
ld a,(DRVINDEX)
add a,"A"
ld (DRIVE_MSG),a
ld de,DRIVEIS_MSG
ld c,_ZSTROUT##
call 5
ld a,(BUF_LETTER)
cp 4
jr nz,NORDISK
ld de,RAMDISK_MSG
ld c,_ZSTROUT##
call 5
jp NEXT_DRIVE
NORDISK:
;* If mounted file, print appropriate info
ld a,(BUF_LETTER)
cp 3
jr nz,NOMOUNT
ld de,FILE_S
ld c,_ZSTROUT##
call 5
ld de,BUF_LETTER+4
ld c,_ZSTROUT##
call 5
ld a,(BUF_LETTER+1)
add a,"A"
ld (DRV_S),a
ld de,ONDRV_S
ld c,_ZSTROUT##
call 5
ld a,(BUF_LETTER+2)
and 1
jr z,NO_RDONLY
ld de,RO_S
ld c,_ZSTROUT##
call 5
NO_RDONLY:
ld de,TWOCRLF
ld c,_ZSTROUT##
call 5
ld a,0FFh
ld (BUF_LETTER),a
jp NEXT_DRIVE
NOMOUNT:
;* Get information about the associated driver
ld ix,BUF_LETTER
ld d,(ix+1)
ld e,(ix+2)
ld ix,BUF_DRIVER
ld h,(ix)
ld l,(ix+1)
or a
sbc hl,de ;Do not get info again
jr z,OK_INFO ;if it is the same driver as previous drive
xor a
ld hl,BUF_DRIVER
ld c,_GDRVR##
call 5
ld b,a
ld c,_TERM##
jp nz,5
OK_INFO:
;* Print driver name and version number
bit 7,(ix+4)
jr z,IS_LEGACY
ld hl,BUF_DRIVER+8
ld bc,32
call PRPAD##
ld e," "
ld c,_CONOUT##
call 5
ld e,"v"
ld c,_CONOUT##
call 5
ld a,(ix+5)
add a,"0"
ld e,a
ld c,_CONOUT##
call 5 ;Main version number
ld e,"."
ld c,_CONOUT##
call 5
ld a,(ix+6)
add a,"0"
ld e,a
ld c,_CONOUT##
call 5 ;Secondary version number
ld a,(ix+7)
or a
jr z,OK_NAME
ld e,"."
ld c,_CONOUT##
call 5
ld a,(ix+7)
add a,"0"
ld e,a
ld c,_CONOUT##
call 5 ;Revision number, only if not zero
jr OK_NAME
IS_LEGACY:
ld de,LEGACY_MSG
ld c,_ZSTROUT##
call 5
OK_NAME:
;* Print slot number
ld de,ONSLOT_S
ld c,_ZSTROUT##
call 5
ld a,(ix)
ld b,(ix+1)
call PRSLOT##
ld de,CRLF
ld c,_ZSTROUT##
call 5
;* Print relative unit number or device+LUN
ld ix,BUF_LETTER
ld a,(BUF_DRIVER+4)
and 1
jr z,SHOW_REL
ld a,(ix+4)
add a,"0"
ld (DEVICE),a
ld a,(ix+5)
add a,"0"
ld (LUN),a
ld de,DEVLUN_MSG
ld c,_ZSTROUT##
call 5
jr OK_DEVLUN
SHOW_REL:
ld a,(ix+3)
add a,"0"
ld (RELUNIT),a
ld de,RELUNIT_MSG
ld c,_ZSTROUT##
call 5
OK_DEVLUN:
;* Go to the next drive
NEXT_DRIVE:
ld a,(DRVINDEX)
inc a
ld (DRVINDEX),a
cp 8
jp c,MAIN_LOOP
ld bc,_TERM##
jp 5
RAMDISK_MSG:
db "RAM disk",13,10,10,0
DEVLUN_MSG:
db "Device "
DEVICE:
db "0, LUN "
LUN:
db "0",13,10,10,0
RELUNIT_MSG:
db "Relative unit "
RELUNIT:
db "0",13,10,10,0
LEGACY_MSG:
db "Legacy driver",0
DRIVEIS_MSG:
db "Drive "
DRIVE_MSG:
db "A: is assigned to:",13,10,0
ONSLOT_S:
db " on slot ",0
FILE_S:
db "File ",0
ONDRV_S:
db " on drive "
DRV_S:
db "X:",0
RO_S:
db " (read only)",0
TWOCRLF:
db 13,10
CRLF:
db 13,10,0
DRVINDEX: db 0
BUF_DRIVER: ds 64
BUF_LETTER:
end