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