forked from Konamiman/Nextor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDRIVERS.MAC
199 lines (153 loc) · 2.61 KB
/
DRIVERS.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
.z80
jp START
; -------------------------------------------------------------------------------
db 13
db "DRIVERS - displays information about the disk drivers present in the system",13,10
db 13,10
db "Usage: DRIVERS",13,10
db 1Ah
START:
call CHK250##
ld a,1
ld (INDEX),a
;--- Loop for all available drivers, until GDRVR returns error
MAIN_LOOP:
ld a,(INDEX)
ld hl,BUF
ld c,_GDRVR##
call 5
ld b,0
ld c,_TERM##
jp nz,5
ld ix,BUF
;* Print driver name and version number
bit 7,(ix+4)
jr z,IS_LEGACY
ld hl,BUF+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 driver type
bit 7,(ix+4)
jr z,IS_LEGACY_2
ld de,DEVBASED_MSG
bit 0,(ix+4)
jr nz,PRINT_TYPE
ld de,DRVBASED_MSG
PRINT_TYPE:
ld c,_ZSTROUT##
call 5
IS_LEGACY_2:
;* Print number of assigned drives
ld a,(ix+2)
or a
jr nz,HAS_DRIVES
ld de,NODRIVES_MSG
ld c,_ZSTROUT##
call 5
jr OK_PRINT_DRIVES
HAS_DRIVES:
cp 1
jr nz,HAS_MANY_DRIVES
ld a,(ix+3)
add a,"A"
ld (ONEDRIVE),a
ld de,ONEDRIVE_MSG
ld c,_ZSTROUT##
call 5
jr OK_PRINT_DRIVES
HAS_MANY_DRIVES:
ld b,a
add a,"0"
ld (NUMDRIVES),a
ld a,(ix+3)
add a,"A"
ld c,a
ld (FIRSTDRIVE),a
ld a,b
add a,c
dec a
ld (LASTDRIVE),a
ld de,DRVASSIGN_MSG
ld c,_ZSTROUT##
call 5
OK_PRINT_DRIVES:
;* Go to the next driver
ld de,CRLF
ld c,_ZSTROUT##
call 5
ld hl,INDEX
inc (hl)
jp MAIN_LOOP
DEVBASED_MSG:
db "Type: device-based",13,10,0
DRVBASED_MSG:
db "Type: drive-based",13,10,0
LEGACY_MSG:
db "Legacy driver",0
ONSLOT_S:
db " on slot ",0
NODRIVES_MSG:
db "No drives assigned at boot time",13,10,0
ONEDRIVE_MSG:
db "Drives assigned at boot time: 1, "
ONEDRIVE:
db "A:",13,10,0
DRVASSIGN_MSG:
db "Drives assigned at boot time: "
NUMDRIVES:
db "0, from "
FIRSTDRIVE:
"A: to "
LASTDRIVE:
"Z:"
CRLF:
db 13,10,0
INDEX: db 0
BUF:
end