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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1 ********************************************************************
15
0912ac5dc2ff Added initial and dates to some source files
boisy
parents: 0
diff changeset
2 * Mfree - Show free memory
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
3 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
4 * $Id$
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
5 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
6 * Ed. Comments Who YY/MM/DD
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
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
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
9
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
10 nam Mfree
15
0912ac5dc2ff Added initial and dates to some source files
boisy
parents: 0
diff changeset
11 ttl Show free memory
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
12
15
0912ac5dc2ff Added initial and dates to some source files
boisy
parents: 0
diff changeset
13 * Disassembled 02/04/05 15:22:05 by Disasm v1.6 (C) 1988 by RML
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
14
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
15 ifp1
15
0912ac5dc2ff Added initial and dates to some source files
boisy
parents: 0
diff changeset
16 use defsfile
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
17 endc
15
0912ac5dc2ff Added initial and dates to some source files
boisy
parents: 0
diff changeset
18
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
19 tylg set Prgrm+Objct
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
20 atrv set ReEnt+rev
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
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
0912ac5dc2ff Added initial and dates to some source files
boisy
parents: 0
diff changeset
24
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
25 mod eom,name,tylg,atrv,start,size
15
0912ac5dc2ff Added initial and dates to some source files
boisy
parents: 0
diff changeset
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
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
29 u0004 rmb 1
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
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
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
36 size equ .
15
0912ac5dc2ff Added initial and dates to some source files
boisy
parents: 0
diff changeset
37
0912ac5dc2ff Added initial and dates to some source files
boisy
parents: 0
diff changeset
38 name fcs /Mfree/
200
e9ce43cc215e Made major changes to headers for consistency and identification
boisy
parents: 90
diff changeset
39 fcb edition
15
0912ac5dc2ff Added initial and dates to some source files
boisy
parents: 0
diff changeset
40
90
6aa54d3691e5 I needed to understand how OS9 does its memory housekeeping.
roug
parents: 15
diff changeset
41 header fcb C$LF
15
0912ac5dc2ff Added initial and dates to some source files
boisy
parents: 0
diff changeset
42 fcc " Address pages"
0912ac5dc2ff Added initial and dates to some source files
boisy
parents: 0
diff changeset
43 fcb C$LF
0912ac5dc2ff Added initial and dates to some source files
boisy
parents: 0
diff changeset
44 fcc "--------- -----"
0912ac5dc2ff Added initial and dates to some source files
boisy
parents: 0
diff changeset
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
0912ac5dc2ff Added initial and dates to some source files
boisy
parents: 0
diff changeset
47 fcs "Total pages free = "
0912ac5dc2ff Added initial and dates to some source files
boisy
parents: 0
diff changeset
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
0912ac5dc2ff Added initial and dates to some source files
boisy
parents: 0
diff changeset
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
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
61 clra
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
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
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
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
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
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
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
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
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
79 clrb
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
80 os9 F$Exit
90
6aa54d3691e5 I needed to understand how OS9 does its memory housekeeping.
roug
parents: 15
diff changeset
81 *
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
82 L00A8 bsr L00AA
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
83 L00AA bsr L00AC
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
84 L00AC bsr L00AE
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
85 L00AE lsla
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
86 bcs L00B8
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
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
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
90 rts
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
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
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
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
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
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
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
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
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
115 anda #$7F
90
6aa54d3691e5 I needed to understand how OS9 does its memory housekeeping.
roug
parents: 15
diff changeset
116 bsr ApndA
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
117 lda ,y+
90
6aa54d3691e5 I needed to understand how OS9 does its memory housekeeping.
roug
parents: 15
diff changeset
118 bpl ApndStr
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
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
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
130 os9 I$WritLn
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
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
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
137 clr <u0004
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
138 L0105 inca
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
139 subb #$64
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
140 bcc L0105
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
141 bsr L0119
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
142 lda #$0A
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
143 L010E deca
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
144 addb #$0A
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
145 bcc L010E
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
146 bsr L0119
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
147 tfr b,a
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
148 inc <u0004
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
149 L0119 tsta
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
150 beq L011E
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
151 sta <u0004
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
152 L011E tst <u0004
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
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
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
156 cmpa #$3A
90
6aa54d3691e5 I needed to understand how OS9 does its memory housekeeping.
roug
parents: 15
diff changeset
157 bcs ApndA
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
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
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
164 sta ,x+
90
6aa54d3691e5 I needed to understand how OS9 does its memory housekeeping.
roug
parents: 15
diff changeset
165 stx <bufptr
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
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
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
171 bsr L013C
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
172 tfr b,a
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
173 L013C pshs a
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
174 lsra
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
175 lsra
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
176 lsra
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
177 lsra
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
178 bsr L0146
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
179 puls a
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
180 L0146 anda #$0F
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
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
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
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
0912ac5dc2ff Added initial and dates to some source files
boisy
parents: 0
diff changeset
186 ldb #SS.DStat
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
187 os9 I$GetStt
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
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
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
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
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
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
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
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
0912ac5dc2ff Added initial and dates to some source files
boisy
parents: 0
diff changeset
198
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
199 emod
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
200 eom equ *
15
0912ac5dc2ff Added initial and dates to some source files
boisy
parents: 0
diff changeset
201 end
0912ac5dc2ff Added initial and dates to some source files
boisy
parents: 0
diff changeset
202