-
-
Notifications
You must be signed in to change notification settings - Fork 35
/
RALLOC.MAC
184 lines (145 loc) · 2.63 KB
/
RALLOC.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
.z80
jp START
; -------------------------------------------------------------------------------
db 13
db "RALLOC - Enable or disable the reduced allocation information mode for a drive",13,10
db 13,10
db "When the reduced allocation information mode for a drive is enabled,",13,10
db "MSX-DOS function ALLOC will return the total and/or free space information",13,10
db "for that drive reduced if necessary, so that the sector count fits in 16 bits",13,10
db "(that is, the space information returned will be smaller than 32MB).",13,10
db 13,10
db "Usage: RALLOC [<drive letter>: ON|OFF]",13,10
db 1Ah
START:
call CHK250##
ld de,BUF
ld a,1
call EXTPAR##
jr c,DO_GET
;--- Set value
;* Get drive letter as a bit mask
; (1=A, 10b=B, 100b=C ...)
ld hl,BUF
call CHKL2##
cp .IPARM##
ld b,a
jp z,DO_TERM
dec a
ld b,a
ld a,1
jr z,LET_OK
LET_LOOP:
rlca
djnz LET_LOOP
LET_OK:
push af
;* Get ON/OFF switch
ld a,2
ld hl,BUF
call EXTPAR
ld b,.NOPAR##
jp c,DO_TERM
ld hl,BUF
call CHKONOFF##
push af
;* Get current RALLOC vector
xor a
ld c,_RALLOC
call 5
ld b,a
jp nz,DO_TERM
pop af ;A=0 for OFF, FFh for ON
pop bc ;B=Drive letter mask
or a
jr z,DO_OFF
;* Set ON
ld a,l ;L=Current mask
or b
jr DO_SET
;* Set OFF
DO_OFF: ld a,b
cpl
and l
;* Write new vector
DO_SET:
ld l,a
ld a,1
ld c,_RALLOC##
call 5
ld b,a
jp nz,DO_TERM
;--- Get current vector and print it
DO_GET:
xor a
ld c,_RALLOC##
call 5
ld b,a
ld c,_TERM##
jp nz,5
ld a,l
or a
jr nz,DO_PRINT
;* No drives in RALLOC mode
ld de,NORALLOC_MSG
ld c,_ZSTROUT##
call 5
ld b,a
ld c,_TERM##
jp 5
DO_PRINT:
;* There are drives in RALLOC mode: print them
push hl
ld de,RALLOC_MSG
ld c,_ZSTROUT##
call 5
pop hl
ld b,8
ld h,"A"
PRINT_LOOP:
rr l
jr nc,PRINT_NEXT
push hl
push bc
ld a,h
ld (DRIVE_MSG),a
ld de,DRIVE_MSG
ld c,_ZSTROUT##
call 5
pop bc
pop hl
PRINT_NEXT:
inc h
djnz PRINT_LOOP
ld de,CRLF
ld c,_ZSTROUT##
call 5
ld b,a
ld c,_TERM##
jp 5
DO_TERM:
ld a,b
or a
ld c,_TERM##
jp z,5
push bc
ld de,USAGE_S
ld c,_ZSTROUT##
call 5
pop bc
ld c,_TERM##
jp 5
USAGE_S:
db "Usage: RALLOC [<drive letter>: ON|OFF]",13,10
db 13,10
db "TYPE RALLOC.COM for more details.",13,10
db 0
NORALLOC_MSG:
db "There are no drives in reduced allocation information mode."
CRLF: db 13,10,0
RALLOC_MSG:
db "The following drives are in reduced allocation information mode:",13,10,0
DRIVE_MSG:
db "A: ",0
BUF:
end