Mercurial > hg > Members > kono > nitros9-code
annotate level1/cmds/free.asm @ 1166:bb618bed0bdc
Miscellaneous source improvements
author | boisy |
---|---|
date | Mon, 19 May 2003 11:06:54 +0000 |
parents | c155aac72190 |
children | 84ea83668304 |
rev | line source |
---|---|
0 | 1 ******************************************************************** |
2 * Free - Print disk free space | |
3 * | |
4 * $Id$ | |
5 * | |
6 * Ed. Comments Who YY/MM/DD | |
7 * ------------------------------------------------------------------ | |
200
e9ce43cc215e
Made major changes to headers for consistency and identification
boisy
parents:
0
diff
changeset
|
8 * 6 From Tandy OS-9 Level One VR 02.00.00 |
e9ce43cc215e
Made major changes to headers for consistency and identification
boisy
parents:
0
diff
changeset
|
9 * 7 Y2K fixed |
0 | 10 |
11 nam Free | |
12 ttl Print disk free space | |
13 | |
14 * Disassembled 98/09/11 16:58:25 by Disasm v1.6 (C) 1988 by RML | |
15 | |
16 ifp1 | |
17 use defsfile | |
18 endc | |
19 | |
20 tylg set Prgrm+Objct | |
21 atrv set ReEnt+rev | |
22 rev set $00 | |
23 edition set 7 | |
24 | |
25 mod eom,name,tylg,atrv,start,size | |
26 | |
924 | 27 org 0 |
0 | 28 u0000 rmb 1 |
29 u0001 rmb 1 | |
30 u0002 rmb 1 | |
919 | 31 devpath rmb 1 |
0 | 32 u0004 rmb 1 |
33 u0005 rmb 2 | |
34 u0007 rmb 1 | |
35 u0008 rmb 1 | |
36 u0009 rmb 1 | |
37 u000A rmb 1 | |
38 u000B rmb 1 | |
39 u000C rmb 1 | |
40 u000D rmb 26 | |
41 u0027 rmb 54 | |
42 u005D rmb 4 | |
43 u0061 rmb 2 | |
44 u0063 rmb 1 | |
45 u0064 rmb 19 | |
46 u0077 rmb 5 | |
47 u007C rmb 26 | |
48 u0096 rmb 6 | |
49 u009C rmb 2 | |
50 u009E rmb 2 | |
51 u00A0 rmb 4544 | |
52 size equ . | |
53 | |
54 name fcs /Free/ | |
55 fcb edition | |
921
617c1b90e623
Added DOHELP conditionals, set all to zero to eliminate help from commands
boisy
parents:
919
diff
changeset
|
56 IFNE DOHELP |
919 | 57 HelpMsg fcb C$LF |
0 | 58 fcc "Use: free [/diskname]" |
59 fcb C$LF | |
60 fcc " tells how many disk sectors are unused" | |
61 fcb C$CR | |
921
617c1b90e623
Added DOHELP conditionals, set all to zero to eliminate help from commands
boisy
parents:
919
diff
changeset
|
62 ENDC |
0 | 63 L0052 fcs /" created on:/ |
64 L005F fcs "Capacity:" | |
65 L0068 fcs " sectors (" | |
66 L0072 fcs "-sector clusters)" | |
67 L0083 fcs " free sectors, largest block" | |
68 L009F fcs " sectors" | |
69 | |
1166 | 70 start leay $0D,u |
0 | 71 sty <u0001 |
72 cmpd #$0000 | |
73 beq L00E0 | |
74 lda ,x+ | |
75 cmpa #C$CR | |
76 beq L00E0 | |
77 cmpa #PDELIM | |
78 beq L00CC | |
921
617c1b90e623
Added DOHELP conditionals, set all to zero to eliminate help from commands
boisy
parents:
919
diff
changeset
|
79 L00BC equ * |
617c1b90e623
Added DOHELP conditionals, set all to zero to eliminate help from commands
boisy
parents:
919
diff
changeset
|
80 IFNE DOHELP |
617c1b90e623
Added DOHELP conditionals, set all to zero to eliminate help from commands
boisy
parents:
919
diff
changeset
|
81 leax >HelpMsg,pcr point to help message |
919 | 82 ldy #64 max bytes |
83 lda #$02 stderr | |
84 os9 I$WritLn write it | |
921
617c1b90e623
Added DOHELP conditionals, set all to zero to eliminate help from commands
boisy
parents:
919
diff
changeset
|
85 ENDC |
919 | 86 lbra ExitOk and branch |
0 | 87 L00CC leax -$01,x |
88 pshs x | |
1166 | 89 os9 F$PrsNam parse the device name on cmd line |
0 | 90 puls x |
1166 | 91 bcs L00BC branch if error |
0 | 92 L00D7 lda ,x+ |
93 lbsr L0218 | |
1166 | 94 * try decb here |
0 | 95 subb #$01 |
96 bcc L00D7 | |
1166 | 97 L00E0 lda #PENTIR we want the entire device |
0 | 98 lbsr L0218 |
99 lbsr L0216 | |
100 leax u000D,u | |
101 stx <u0001 | |
1166 | 102 lda #READ. read mode |
103 os9 I$Open open the device | |
104 sta <devpath save the path | |
105 bcs L00FF branch if error | |
0 | 106 leax <u005D,u |
107 ldy #$003F | |
108 os9 I$Read | |
919 | 109 L00FF lbcs Exit |
0 | 110 lbsr L0222 |
111 lda #$22 | |
112 lbsr L0218 | |
113 leay <u007C,u | |
114 lbsr L020C | |
115 dec <u0002 | |
116 leay >L0052,pcr | |
117 lbsr L020C | |
118 lbsr L0293 | |
119 lbsr L0222 | |
120 leay >L005F,pcr | |
121 lbsr L020C | |
122 leax <u005D,u | |
123 lbsr L024F | |
124 leay >L0068,pcr | |
125 lbsr L020C | |
126 dec <u0002 | |
127 ldd <u0063 | |
128 pshs b,a | |
129 clr ,-s | |
130 leax ,s | |
131 lbsr L024F | |
132 leas $03,s | |
133 leay >L0072,pcr | |
134 lbsr L020C | |
135 lbsr L0222 | |
136 clra | |
137 clrb | |
138 sta <u0004 | |
139 std <u0005 | |
140 sta <u000A | |
141 std <u000B | |
142 sta <u0007 | |
143 std <u0008 | |
919 | 144 lda <devpath |
0 | 145 ldx #$0000 |
146 pshs u | |
1166 | 147 ldu #256 |
148 os9 I$Seek seek to bitmap sector | |
0 | 149 puls u |
150 L016A leax >u009E,u | |
151 ldd #$1000 | |
152 cmpd <u0061 | |
153 bls L0178 | |
154 ldd <u0061 | |
155 L0178 leay d,x | |
156 sty <u009C | |
157 tfr d,y | |
919 | 158 lda <devpath |
0 | 159 os9 I$Read |
919 | 160 bcs Exit |
0 | 161 L0186 lda ,x+ |
162 bsr L01D0 | |
163 stb ,-s | |
164 beq L019C | |
165 L018E ldd <u0005 | |
166 addd <u0063 | |
167 std <u0005 | |
168 bcc L0198 | |
169 inc <u0004 | |
170 L0198 dec ,s | |
171 bne L018E | |
172 L019C leas $01,s | |
173 cmpx <u009C | |
174 bcs L0186 | |
175 ldd <u0061 | |
176 subd #$1000 | |
177 std <u0061 | |
178 bhi L016A | |
179 bsr L01ED | |
180 leax u0004,u | |
181 lbsr L024F | |
182 leay >L0083,pcr | |
183 bsr L020C | |
184 leax u0007,u | |
185 lbsr L024F | |
186 leay >L009F,pcr | |
187 bsr L020C | |
188 bsr L0222 | |
919 | 189 lda <devpath |
0 | 190 os9 I$Close |
919 | 191 bcs Exit |
192 ExitOk clrb | |
193 Exit os9 F$Exit | |
0 | 194 L01D0 clrb |
195 cmpa #$FF | |
196 beq L01ED | |
197 bsr L01D7 | |
198 L01D7 bsr L01D9 | |
199 L01D9 bsr L01DB | |
200 L01DB lsla | |
201 bcs L01ED | |
202 incb | |
203 pshs b,a | |
204 ldd <u000B | |
205 addd <u0063 | |
206 std <u000B | |
207 bcc L01EB | |
208 inc <u000A | |
209 L01EB puls pc,b,a | |
210 L01ED pshs b,a | |
211 ldd <u000A | |
212 cmpd <u0007 | |
213 bhi L01FE | |
214 bne L0204 | |
215 ldb <u000C | |
216 cmpb <u0009 | |
217 bls L0204 | |
218 L01FE sta <u0007 | |
219 ldd <u000B | |
220 std <u0008 | |
221 L0204 clr <u000A | |
222 clr <u000B | |
223 clr <u000C | |
224 puls pc,b,a | |
225 L020C lda ,y | |
226 anda #$7F | |
227 bsr L0218 | |
228 lda ,y+ | |
229 bpl L020C | |
1166 | 230 L0216 lda #C$SPAC |
0 | 231 L0218 pshs x |
232 ldx <u0001 | |
233 sta ,x+ | |
234 stx <u0001 | |
235 puls pc,x | |
236 L0222 pshs y,x,a | |
1166 | 237 lda #C$CR |
0 | 238 bsr L0218 |
239 leax u000D,u | |
240 stx <u0001 | |
1166 | 241 ldy #80 |
242 lda #$01 standard output | |
243 os9 I$WritLn write the line | |
0 | 244 puls pc,y,x,a |
1166 | 245 |
246 L0237 fcb $98,$96,$80 | |
247 fcb $0f,$42,$40 | |
248 fcb $01,$86,$a0 | |
249 fcb $00,$27,$10 | |
250 fcb $00,$03,$e8 | |
251 fcb $00,$00,$64 | |
252 fcb $00,$00,$0a | |
253 fcb $00,$00,$01 | |
254 | |
0 | 255 L024F lda #$0A |
256 pshs y,x,b,a | |
257 leay <L0237,pcr | |
258 clr <u0000 | |
259 ldb ,x | |
260 ldx $01,x | |
261 L025C lda #$FF | |
262 L025E inca | |
263 exg d,x | |
264 subd $01,y | |
265 exg d,x | |
266 sbcb ,y | |
267 bcc L025E | |
268 bsr L02B9 | |
269 exg d,x | |
270 addd $01,y | |
271 exg d,x | |
272 adcb ,y | |
273 leay $03,y | |
274 dec ,s | |
275 beq L0291 | |
276 lda ,s | |
277 cmpa #$01 | |
278 bne L0281 | |
279 sta <u0000 | |
280 L0281 bita #$03 | |
281 bne L025C | |
282 dec ,s | |
283 tst <u0000 | |
284 beq L025C | |
285 lda #$2C | |
286 bsr L0218 | |
287 bra L025C | |
288 L0291 puls pc,y,x,b,a | |
919 | 289 |
0 | 290 L0293 leax <u0077,u |
291 bsr L02C3 | |
292 bsr L029A | |
293 L029A lda #$2F | |
294 lbsr L0218 | |
295 clr <u0000 | |
296 ldb ,x+ | |
297 lda #$FF | |
298 L02A5 inca | |
299 subb #$64 | |
300 bcc L02A5 | |
301 bsr L02B9 | |
302 L02AC lda #$0A | |
303 sta <u0000 | |
304 L02B0 deca | |
305 addb #$0A | |
306 bcc L02B0 | |
307 bsr L02B9 | |
308 tfr b,a | |
309 L02B9 tsta | |
310 beq L02BE | |
311 sta <u0000 | |
312 L02BE tst <u0000 | |
313 bne L02D6 | |
314 rts | |
315 L02C3 ldb ,x+ | |
316 lda #$AE | |
317 L02C7 inca | |
318 subb #$64 | |
319 bcc L02C7 | |
320 pshs b | |
321 tfr a,b | |
322 bsr L02AC | |
323 puls b | |
324 bra L02AC | |
325 L02D6 adda #$30 | |
326 lbra L0218 | |
327 | |
328 emod | |
329 eom equ * | |
330 end |