Mercurial > hg > Members > kono > nitros9-code
annotate level1/cmds/mfree.asm @ 827:6653afab1671
Made smaller, better!
author | boisy |
---|---|
date | Tue, 14 Jan 2003 02:58:01 +0000 |
parents | e9ce43cc215e |
children | c155aac72190 |
rev | line source |
---|---|
0 | 1 ******************************************************************** |
15 | 2 * Mfree - Show free memory |
0 | 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:
90
diff
changeset
|
8 * 5 From Tandy OS-9 Level One VR 02.00.00 |
0 | 9 |
10 nam Mfree | |
15 | 11 ttl Show free memory |
0 | 12 |
15 | 13 * Disassembled 02/04/05 15:22:05 by Disasm v1.6 (C) 1988 by RML |
0 | 14 |
15 ifp1 | |
15 | 16 use defsfile |
0 | 17 endc |
15 | 18 |
0 | 19 tylg set Prgrm+Objct |
20 atrv set ReEnt+rev | |
21 rev set $01 | |
200
e9ce43cc215e
Made major changes to headers for consistency and identification
boisy
parents:
90
diff
changeset
|
22 edition set 5 |
90
6aa54d3691e5
I needed to understand how OS9 does its memory housekeeping.
roug
parents:
15
diff
changeset
|
23 stdout set 1 |
15 | 24 |
0 | 25 mod eom,name,tylg,atrv,start,size |
15 | 26 |
90
6aa54d3691e5
I needed to understand how OS9 does its memory housekeeping.
roug
parents:
15
diff
changeset
|
27 fmbegin rmb 2 |
6aa54d3691e5
I needed to understand how OS9 does its memory housekeeping.
roug
parents:
15
diff
changeset
|
28 fmend rmb 2 |
0 | 29 u0004 rmb 1 |
30 u0005 rmb 1 | |
90
6aa54d3691e5
I needed to understand how OS9 does its memory housekeeping.
roug
parents:
15
diff
changeset
|
31 upper rmb 2 Upper boundary of free segment |
6aa54d3691e5
I needed to understand how OS9 does its memory housekeeping.
roug
parents:
15
diff
changeset
|
32 lower rmb 2 Lower boundary of free segment |
6aa54d3691e5
I needed to understand how OS9 does its memory housekeeping.
roug
parents:
15
diff
changeset
|
33 pages rmb 1 |
6aa54d3691e5
I needed to understand how OS9 does its memory housekeeping.
roug
parents:
15
diff
changeset
|
34 bufptr rmb 2 |
6aa54d3691e5
I needed to understand how OS9 does its memory housekeeping.
roug
parents:
15
diff
changeset
|
35 buffer rmb 530 |
0 | 36 size equ . |
15 | 37 |
38 name fcs /Mfree/ | |
200
e9ce43cc215e
Made major changes to headers for consistency and identification
boisy
parents:
90
diff
changeset
|
39 fcb edition |
15 | 40 |
90
6aa54d3691e5
I needed to understand how OS9 does its memory housekeeping.
roug
parents:
15
diff
changeset
|
41 header fcb C$LF |
15 | 42 fcc " Address pages" |
43 fcb C$LF | |
44 fcc "--------- -----" | |
45 fcb $80+C$CR | |
90
6aa54d3691e5
I needed to understand how OS9 does its memory housekeeping.
roug
parents:
15
diff
changeset
|
46 totfree fcb C$LF |
15 | 47 fcs "Total pages free = " |
48 L0048 fcs "Graphics Memory " | |
90
6aa54d3691e5
I needed to understand how OS9 does its memory housekeeping.
roug
parents:
15
diff
changeset
|
49 notalloc fcs "Not Allocated" |
6aa54d3691e5
I needed to understand how OS9 does its memory housekeeping.
roug
parents:
15
diff
changeset
|
50 ataddr fcs "at: $" |
15 | 51 |
90
6aa54d3691e5
I needed to understand how OS9 does its memory housekeeping.
roug
parents:
15
diff
changeset
|
52 start leay buffer,u |
6aa54d3691e5
I needed to understand how OS9 does its memory housekeeping.
roug
parents:
15
diff
changeset
|
53 sty <bufptr |
6aa54d3691e5
I needed to understand how OS9 does its memory housekeeping.
roug
parents:
15
diff
changeset
|
54 leay <header,pcr |
6aa54d3691e5
I needed to understand how OS9 does its memory housekeeping.
roug
parents:
15
diff
changeset
|
55 bsr ApndStr |
6aa54d3691e5
I needed to understand how OS9 does its memory housekeeping.
roug
parents:
15
diff
changeset
|
56 bsr print |
6aa54d3691e5
I needed to understand how OS9 does its memory housekeeping.
roug
parents:
15
diff
changeset
|
57 ldx >D.FMBM The free memory bitmap pointer start |
6aa54d3691e5
I needed to understand how OS9 does its memory housekeeping.
roug
parents:
15
diff
changeset
|
58 stx <fmbegin |
6aa54d3691e5
I needed to understand how OS9 does its memory housekeeping.
roug
parents:
15
diff
changeset
|
59 ldx >D.FMBM+2 The free memory bitmap pointer end |
6aa54d3691e5
I needed to understand how OS9 does its memory housekeeping.
roug
parents:
15
diff
changeset
|
60 stx <fmend |
0 | 61 clra |
62 clrb | |
90
6aa54d3691e5
I needed to understand how OS9 does its memory housekeeping.
roug
parents:
15
diff
changeset
|
63 sta <u0005 Clear |
6aa54d3691e5
I needed to understand how OS9 does its memory housekeeping.
roug
parents:
15
diff
changeset
|
64 std <upper Clear |
6aa54d3691e5
I needed to understand how OS9 does its memory housekeeping.
roug
parents:
15
diff
changeset
|
65 std <lower Clear |
6aa54d3691e5
I needed to understand how OS9 does its memory housekeeping.
roug
parents:
15
diff
changeset
|
66 stb <pages Clear |
6aa54d3691e5
I needed to understand how OS9 does its memory housekeeping.
roug
parents:
15
diff
changeset
|
67 ldx <fmbegin |
6aa54d3691e5
I needed to understand how OS9 does its memory housekeeping.
roug
parents:
15
diff
changeset
|
68 nextbyte lda ,x+ |
0 | 69 bsr L00A8 |
90
6aa54d3691e5
I needed to understand how OS9 does its memory housekeeping.
roug
parents:
15
diff
changeset
|
70 cmpx <fmend |
6aa54d3691e5
I needed to understand how OS9 does its memory housekeeping.
roug
parents:
15
diff
changeset
|
71 bcs nextbyte |
0 | 72 bsr L00B8 |
90
6aa54d3691e5
I needed to understand how OS9 does its memory housekeeping.
roug
parents:
15
diff
changeset
|
73 leay <totfree,pcr |
6aa54d3691e5
I needed to understand how OS9 does its memory housekeeping.
roug
parents:
15
diff
changeset
|
74 bsr ApndStr |
0 | 75 ldb <u0005 |
90
6aa54d3691e5
I needed to understand how OS9 does its memory housekeeping.
roug
parents:
15
diff
changeset
|
76 bsr bDeci |
6aa54d3691e5
I needed to understand how OS9 does its memory housekeeping.
roug
parents:
15
diff
changeset
|
77 bsr print |
6aa54d3691e5
I needed to understand how OS9 does its memory housekeeping.
roug
parents:
15
diff
changeset
|
78 lbsr display |
0 | 79 clrb |
80 os9 F$Exit | |
90
6aa54d3691e5
I needed to understand how OS9 does its memory housekeeping.
roug
parents:
15
diff
changeset
|
81 * |
0 | 82 L00A8 bsr L00AA |
83 L00AA bsr L00AC | |
84 L00AC bsr L00AE | |
85 L00AE lsla | |
86 bcs L00B8 | |
87 inc <u0005 | |
90
6aa54d3691e5
I needed to understand how OS9 does its memory housekeeping.
roug
parents:
15
diff
changeset
|
88 inc <pages |
6aa54d3691e5
I needed to understand how OS9 does its memory housekeeping.
roug
parents:
15
diff
changeset
|
89 inc <upper |
0 | 90 rts |
91 L00B8 pshs b,a | |
90
6aa54d3691e5
I needed to understand how OS9 does its memory housekeeping.
roug
parents:
15
diff
changeset
|
92 ldb <pages |
0 | 93 beq L00D7 |
90
6aa54d3691e5
I needed to understand how OS9 does its memory housekeeping.
roug
parents:
15
diff
changeset
|
94 ldd <lower |
6aa54d3691e5
I needed to understand how OS9 does its memory housekeeping.
roug
parents:
15
diff
changeset
|
95 bsr dHexa |
6aa54d3691e5
I needed to understand how OS9 does its memory housekeeping.
roug
parents:
15
diff
changeset
|
96 lda #$2D '-' char |
6aa54d3691e5
I needed to understand how OS9 does its memory housekeeping.
roug
parents:
15
diff
changeset
|
97 bsr ApndA |
6aa54d3691e5
I needed to understand how OS9 does its memory housekeeping.
roug
parents:
15
diff
changeset
|
98 ldd <upper |
0 | 99 subd #$0001 |
90
6aa54d3691e5
I needed to understand how OS9 does its memory housekeeping.
roug
parents:
15
diff
changeset
|
100 bsr dHexa |
6aa54d3691e5
I needed to understand how OS9 does its memory housekeeping.
roug
parents:
15
diff
changeset
|
101 bsr aspace Append a space to buffer |
6aa54d3691e5
I needed to understand how OS9 does its memory housekeeping.
roug
parents:
15
diff
changeset
|
102 bsr aspace Append a space to buffer |
6aa54d3691e5
I needed to understand how OS9 does its memory housekeeping.
roug
parents:
15
diff
changeset
|
103 ldb <pages |
6aa54d3691e5
I needed to understand how OS9 does its memory housekeeping.
roug
parents:
15
diff
changeset
|
104 bsr bDeci |
6aa54d3691e5
I needed to understand how OS9 does its memory housekeeping.
roug
parents:
15
diff
changeset
|
105 bsr print |
6aa54d3691e5
I needed to understand how OS9 does its memory housekeeping.
roug
parents:
15
diff
changeset
|
106 L00D7 inc <upper |
6aa54d3691e5
I needed to understand how OS9 does its memory housekeeping.
roug
parents:
15
diff
changeset
|
107 ldd <upper |
6aa54d3691e5
I needed to understand how OS9 does its memory housekeeping.
roug
parents:
15
diff
changeset
|
108 std <lower |
6aa54d3691e5
I needed to understand how OS9 does its memory housekeeping.
roug
parents:
15
diff
changeset
|
109 clr <pages |
0 | 110 puls pc,b,a |
90
6aa54d3691e5
I needed to understand how OS9 does its memory housekeeping.
roug
parents:
15
diff
changeset
|
111 * |
6aa54d3691e5
I needed to understand how OS9 does its memory housekeeping.
roug
parents:
15
diff
changeset
|
112 * Append string (in reg y) to buffer |
6aa54d3691e5
I needed to understand how OS9 does its memory housekeeping.
roug
parents:
15
diff
changeset
|
113 * |
6aa54d3691e5
I needed to understand how OS9 does its memory housekeeping.
roug
parents:
15
diff
changeset
|
114 ApndStr lda ,y |
0 | 115 anda #$7F |
90
6aa54d3691e5
I needed to understand how OS9 does its memory housekeeping.
roug
parents:
15
diff
changeset
|
116 bsr ApndA |
0 | 117 lda ,y+ |
90
6aa54d3691e5
I needed to understand how OS9 does its memory housekeeping.
roug
parents:
15
diff
changeset
|
118 bpl ApndStr |
0 | 119 rts |
90
6aa54d3691e5
I needed to understand how OS9 does its memory housekeeping.
roug
parents:
15
diff
changeset
|
120 * |
6aa54d3691e5
I needed to understand how OS9 does its memory housekeeping.
roug
parents:
15
diff
changeset
|
121 * Print the buffer |
6aa54d3691e5
I needed to understand how OS9 does its memory housekeeping.
roug
parents:
15
diff
changeset
|
122 * |
6aa54d3691e5
I needed to understand how OS9 does its memory housekeeping.
roug
parents:
15
diff
changeset
|
123 print pshs y,x,a |
6aa54d3691e5
I needed to understand how OS9 does its memory housekeeping.
roug
parents:
15
diff
changeset
|
124 lda #C$CR Add form feed to buffer |
6aa54d3691e5
I needed to understand how OS9 does its memory housekeeping.
roug
parents:
15
diff
changeset
|
125 bsr ApndA |
6aa54d3691e5
I needed to understand how OS9 does its memory housekeeping.
roug
parents:
15
diff
changeset
|
126 leax buffer,u Reset bufptr to start of buffer |
6aa54d3691e5
I needed to understand how OS9 does its memory housekeeping.
roug
parents:
15
diff
changeset
|
127 stx <bufptr |
6aa54d3691e5
I needed to understand how OS9 does its memory housekeeping.
roug
parents:
15
diff
changeset
|
128 ldy #80 Max line length = 80 |
6aa54d3691e5
I needed to understand how OS9 does its memory housekeeping.
roug
parents:
15
diff
changeset
|
129 lda #stdout |
0 | 130 os9 I$WritLn |
131 puls pc,y,x,a | |
90
6aa54d3691e5
I needed to understand how OS9 does its memory housekeeping.
roug
parents:
15
diff
changeset
|
132 * |
6aa54d3691e5
I needed to understand how OS9 does its memory housekeeping.
roug
parents:
15
diff
changeset
|
133 * Appends the content of register B in decimal |
6aa54d3691e5
I needed to understand how OS9 does its memory housekeeping.
roug
parents:
15
diff
changeset
|
134 * to the buffer |
6aa54d3691e5
I needed to understand how OS9 does its memory housekeeping.
roug
parents:
15
diff
changeset
|
135 * |
6aa54d3691e5
I needed to understand how OS9 does its memory housekeeping.
roug
parents:
15
diff
changeset
|
136 bDeci lda #$FF |
0 | 137 clr <u0004 |
138 L0105 inca | |
139 subb #$64 | |
140 bcc L0105 | |
141 bsr L0119 | |
142 lda #$0A | |
143 L010E deca | |
144 addb #$0A | |
145 bcc L010E | |
146 bsr L0119 | |
147 tfr b,a | |
148 inc <u0004 | |
149 L0119 tsta | |
150 beq L011E | |
151 sta <u0004 | |
152 L011E tst <u0004 | |
153 bne L0124 | |
90
6aa54d3691e5
I needed to understand how OS9 does its memory housekeeping.
roug
parents:
15
diff
changeset
|
154 aspace lda #$F0 |
6aa54d3691e5
I needed to understand how OS9 does its memory housekeeping.
roug
parents:
15
diff
changeset
|
155 L0124 adda #$30 Offset to "0" in ascii table |
0 | 156 cmpa #$3A |
90
6aa54d3691e5
I needed to understand how OS9 does its memory housekeeping.
roug
parents:
15
diff
changeset
|
157 bcs ApndA |
0 | 158 adda #$07 |
90
6aa54d3691e5
I needed to understand how OS9 does its memory housekeeping.
roug
parents:
15
diff
changeset
|
159 * |
6aa54d3691e5
I needed to understand how OS9 does its memory housekeeping.
roug
parents:
15
diff
changeset
|
160 * Append character (in a) to buffer |
6aa54d3691e5
I needed to understand how OS9 does its memory housekeeping.
roug
parents:
15
diff
changeset
|
161 * |
6aa54d3691e5
I needed to understand how OS9 does its memory housekeeping.
roug
parents:
15
diff
changeset
|
162 ApndA pshs x |
6aa54d3691e5
I needed to understand how OS9 does its memory housekeeping.
roug
parents:
15
diff
changeset
|
163 ldx <bufptr |
0 | 164 sta ,x+ |
90
6aa54d3691e5
I needed to understand how OS9 does its memory housekeeping.
roug
parents:
15
diff
changeset
|
165 stx <bufptr |
0 | 166 puls pc,x |
90
6aa54d3691e5
I needed to understand how OS9 does its memory housekeeping.
roug
parents:
15
diff
changeset
|
167 * |
6aa54d3691e5
I needed to understand how OS9 does its memory housekeeping.
roug
parents:
15
diff
changeset
|
168 * Append register D as hex string to buffer |
6aa54d3691e5
I needed to understand how OS9 does its memory housekeeping.
roug
parents:
15
diff
changeset
|
169 * |
6aa54d3691e5
I needed to understand how OS9 does its memory housekeeping.
roug
parents:
15
diff
changeset
|
170 dHexa clr <u0004 |
0 | 171 bsr L013C |
172 tfr b,a | |
173 L013C pshs a | |
174 lsra | |
175 lsra | |
176 lsra | |
177 lsra | |
178 bsr L0146 | |
179 puls a | |
180 L0146 anda #$0F | |
181 bra L0119 | |
90
6aa54d3691e5
I needed to understand how OS9 does its memory housekeeping.
roug
parents:
15
diff
changeset
|
182 display pshs y,x |
0 | 183 leay >L0048,pcr |
90
6aa54d3691e5
I needed to understand how OS9 does its memory housekeeping.
roug
parents:
15
diff
changeset
|
184 bsr ApndStr |
6aa54d3691e5
I needed to understand how OS9 does its memory housekeeping.
roug
parents:
15
diff
changeset
|
185 lda #stdout |
15 | 186 ldb #SS.DStat |
0 | 187 os9 I$GetStt |
188 bcc L0163 | |
90
6aa54d3691e5
I needed to understand how OS9 does its memory housekeeping.
roug
parents:
15
diff
changeset
|
189 leay >notalloc,pcr |
6aa54d3691e5
I needed to understand how OS9 does its memory housekeeping.
roug
parents:
15
diff
changeset
|
190 bsr ApndStr |
0 | 191 bra L016E |
90
6aa54d3691e5
I needed to understand how OS9 does its memory housekeeping.
roug
parents:
15
diff
changeset
|
192 L0163 leay >ataddr,pcr |
6aa54d3691e5
I needed to understand how OS9 does its memory housekeeping.
roug
parents:
15
diff
changeset
|
193 lbsr ApndStr |
0 | 194 tfr x,d |
90
6aa54d3691e5
I needed to understand how OS9 does its memory housekeeping.
roug
parents:
15
diff
changeset
|
195 bsr dHexa |
0 | 196 L016E puls y,x |
90
6aa54d3691e5
I needed to understand how OS9 does its memory housekeeping.
roug
parents:
15
diff
changeset
|
197 lbra print |
15 | 198 |
0 | 199 emod |
200 eom equ * | |
15 | 201 end |
202 |