annotate level1/cmds/mfree.asm @ 107:5eceecf6159c

Updated Makefiles with new targets
author boisy
date Sat, 06 Jul 2002 15:28:39 +0000
parents 6aa54d3691e5
children e9ce43cc215e
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 * ------------------------------------------------------------------
15
0912ac5dc2ff Added initial and dates to some source files
boisy
parents: 0
diff changeset
8 * 5 Original Tandy version BGP 02/04/05
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
90
6aa54d3691e5 I needed to understand how OS9 does its memory housekeeping.
roug
parents: 15
diff changeset
22 stdout set 1
15
0912ac5dc2ff Added initial and dates to some source files
boisy
parents: 0
diff changeset
23
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
24 mod eom,name,tylg,atrv,start,size
15
0912ac5dc2ff Added initial and dates to some source files
boisy
parents: 0
diff changeset
25
90
6aa54d3691e5 I needed to understand how OS9 does its memory housekeeping.
roug
parents: 15
diff changeset
26 fmbegin rmb 2
6aa54d3691e5 I needed to understand how OS9 does its memory housekeeping.
roug
parents: 15
diff changeset
27 fmend rmb 2
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
28 u0004 rmb 1
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
29 u0005 rmb 1
90
6aa54d3691e5 I needed to understand how OS9 does its memory housekeeping.
roug
parents: 15
diff changeset
30 upper rmb 2 Upper boundary of free segment
6aa54d3691e5 I needed to understand how OS9 does its memory housekeeping.
roug
parents: 15
diff changeset
31 lower rmb 2 Lower boundary of free segment
6aa54d3691e5 I needed to understand how OS9 does its memory housekeeping.
roug
parents: 15
diff changeset
32 pages rmb 1
6aa54d3691e5 I needed to understand how OS9 does its memory housekeeping.
roug
parents: 15
diff changeset
33 bufptr rmb 2
6aa54d3691e5 I needed to understand how OS9 does its memory housekeeping.
roug
parents: 15
diff changeset
34 buffer rmb 530
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
35 size equ .
15
0912ac5dc2ff Added initial and dates to some source files
boisy
parents: 0
diff changeset
36
0912ac5dc2ff Added initial and dates to some source files
boisy
parents: 0
diff changeset
37 name fcs /Mfree/
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
38 fcb $05
15
0912ac5dc2ff Added initial and dates to some source files
boisy
parents: 0
diff changeset
39
90
6aa54d3691e5 I needed to understand how OS9 does its memory housekeeping.
roug
parents: 15
diff changeset
40 header fcb C$LF
15
0912ac5dc2ff Added initial and dates to some source files
boisy
parents: 0
diff changeset
41 fcc " Address pages"
0912ac5dc2ff Added initial and dates to some source files
boisy
parents: 0
diff changeset
42 fcb C$LF
0912ac5dc2ff Added initial and dates to some source files
boisy
parents: 0
diff changeset
43 fcc "--------- -----"
0912ac5dc2ff Added initial and dates to some source files
boisy
parents: 0
diff changeset
44 fcb $80+C$CR
90
6aa54d3691e5 I needed to understand how OS9 does its memory housekeeping.
roug
parents: 15
diff changeset
45 totfree fcb C$LF
15
0912ac5dc2ff Added initial and dates to some source files
boisy
parents: 0
diff changeset
46 fcs "Total pages free = "
0912ac5dc2ff Added initial and dates to some source files
boisy
parents: 0
diff changeset
47 L0048 fcs "Graphics Memory "
90
6aa54d3691e5 I needed to understand how OS9 does its memory housekeeping.
roug
parents: 15
diff changeset
48 notalloc fcs "Not Allocated"
6aa54d3691e5 I needed to understand how OS9 does its memory housekeeping.
roug
parents: 15
diff changeset
49 ataddr fcs "at: $"
15
0912ac5dc2ff Added initial and dates to some source files
boisy
parents: 0
diff changeset
50
90
6aa54d3691e5 I needed to understand how OS9 does its memory housekeeping.
roug
parents: 15
diff changeset
51 start leay buffer,u
6aa54d3691e5 I needed to understand how OS9 does its memory housekeeping.
roug
parents: 15
diff changeset
52 sty <bufptr
6aa54d3691e5 I needed to understand how OS9 does its memory housekeeping.
roug
parents: 15
diff changeset
53 leay <header,pcr
6aa54d3691e5 I needed to understand how OS9 does its memory housekeeping.
roug
parents: 15
diff changeset
54 bsr ApndStr
6aa54d3691e5 I needed to understand how OS9 does its memory housekeeping.
roug
parents: 15
diff changeset
55 bsr print
6aa54d3691e5 I needed to understand how OS9 does its memory housekeeping.
roug
parents: 15
diff changeset
56 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
57 stx <fmbegin
6aa54d3691e5 I needed to understand how OS9 does its memory housekeeping.
roug
parents: 15
diff changeset
58 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
59 stx <fmend
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
60 clra
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
61 clrb
90
6aa54d3691e5 I needed to understand how OS9 does its memory housekeeping.
roug
parents: 15
diff changeset
62 sta <u0005 Clear
6aa54d3691e5 I needed to understand how OS9 does its memory housekeeping.
roug
parents: 15
diff changeset
63 std <upper Clear
6aa54d3691e5 I needed to understand how OS9 does its memory housekeeping.
roug
parents: 15
diff changeset
64 std <lower Clear
6aa54d3691e5 I needed to understand how OS9 does its memory housekeeping.
roug
parents: 15
diff changeset
65 stb <pages Clear
6aa54d3691e5 I needed to understand how OS9 does its memory housekeeping.
roug
parents: 15
diff changeset
66 ldx <fmbegin
6aa54d3691e5 I needed to understand how OS9 does its memory housekeeping.
roug
parents: 15
diff changeset
67 nextbyte lda ,x+
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
68 bsr L00A8
90
6aa54d3691e5 I needed to understand how OS9 does its memory housekeeping.
roug
parents: 15
diff changeset
69 cmpx <fmend
6aa54d3691e5 I needed to understand how OS9 does its memory housekeeping.
roug
parents: 15
diff changeset
70 bcs nextbyte
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
71 bsr L00B8
90
6aa54d3691e5 I needed to understand how OS9 does its memory housekeeping.
roug
parents: 15
diff changeset
72 leay <totfree,pcr
6aa54d3691e5 I needed to understand how OS9 does its memory housekeeping.
roug
parents: 15
diff changeset
73 bsr ApndStr
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
74 ldb <u0005
90
6aa54d3691e5 I needed to understand how OS9 does its memory housekeeping.
roug
parents: 15
diff changeset
75 bsr bDeci
6aa54d3691e5 I needed to understand how OS9 does its memory housekeeping.
roug
parents: 15
diff changeset
76 bsr print
6aa54d3691e5 I needed to understand how OS9 does its memory housekeeping.
roug
parents: 15
diff changeset
77 lbsr display
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
78 clrb
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
79 os9 F$Exit
90
6aa54d3691e5 I needed to understand how OS9 does its memory housekeeping.
roug
parents: 15
diff changeset
80 *
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
81 L00A8 bsr L00AA
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
82 L00AA bsr L00AC
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
83 L00AC bsr L00AE
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
84 L00AE lsla
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
85 bcs L00B8
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
86 inc <u0005
90
6aa54d3691e5 I needed to understand how OS9 does its memory housekeeping.
roug
parents: 15
diff changeset
87 inc <pages
6aa54d3691e5 I needed to understand how OS9 does its memory housekeeping.
roug
parents: 15
diff changeset
88 inc <upper
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
89 rts
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
90 L00B8 pshs b,a
90
6aa54d3691e5 I needed to understand how OS9 does its memory housekeeping.
roug
parents: 15
diff changeset
91 ldb <pages
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
92 beq L00D7
90
6aa54d3691e5 I needed to understand how OS9 does its memory housekeeping.
roug
parents: 15
diff changeset
93 ldd <lower
6aa54d3691e5 I needed to understand how OS9 does its memory housekeeping.
roug
parents: 15
diff changeset
94 bsr dHexa
6aa54d3691e5 I needed to understand how OS9 does its memory housekeeping.
roug
parents: 15
diff changeset
95 lda #$2D '-' char
6aa54d3691e5 I needed to understand how OS9 does its memory housekeeping.
roug
parents: 15
diff changeset
96 bsr ApndA
6aa54d3691e5 I needed to understand how OS9 does its memory housekeeping.
roug
parents: 15
diff changeset
97 ldd <upper
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
98 subd #$0001
90
6aa54d3691e5 I needed to understand how OS9 does its memory housekeeping.
roug
parents: 15
diff changeset
99 bsr dHexa
6aa54d3691e5 I needed to understand how OS9 does its memory housekeeping.
roug
parents: 15
diff changeset
100 bsr aspace Append a space to buffer
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 ldb <pages
6aa54d3691e5 I needed to understand how OS9 does its memory housekeeping.
roug
parents: 15
diff changeset
103 bsr bDeci
6aa54d3691e5 I needed to understand how OS9 does its memory housekeeping.
roug
parents: 15
diff changeset
104 bsr print
6aa54d3691e5 I needed to understand how OS9 does its memory housekeeping.
roug
parents: 15
diff changeset
105 L00D7 inc <upper
6aa54d3691e5 I needed to understand how OS9 does its memory housekeeping.
roug
parents: 15
diff changeset
106 ldd <upper
6aa54d3691e5 I needed to understand how OS9 does its memory housekeeping.
roug
parents: 15
diff changeset
107 std <lower
6aa54d3691e5 I needed to understand how OS9 does its memory housekeeping.
roug
parents: 15
diff changeset
108 clr <pages
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
109 puls pc,b,a
90
6aa54d3691e5 I needed to understand how OS9 does its memory housekeeping.
roug
parents: 15
diff changeset
110 *
6aa54d3691e5 I needed to understand how OS9 does its memory housekeeping.
roug
parents: 15
diff changeset
111 * Append string (in reg y) to buffer
6aa54d3691e5 I needed to understand how OS9 does its memory housekeeping.
roug
parents: 15
diff changeset
112 *
6aa54d3691e5 I needed to understand how OS9 does its memory housekeeping.
roug
parents: 15
diff changeset
113 ApndStr lda ,y
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
114 anda #$7F
90
6aa54d3691e5 I needed to understand how OS9 does its memory housekeeping.
roug
parents: 15
diff changeset
115 bsr ApndA
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
116 lda ,y+
90
6aa54d3691e5 I needed to understand how OS9 does its memory housekeeping.
roug
parents: 15
diff changeset
117 bpl ApndStr
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
118 rts
90
6aa54d3691e5 I needed to understand how OS9 does its memory housekeeping.
roug
parents: 15
diff changeset
119 *
6aa54d3691e5 I needed to understand how OS9 does its memory housekeeping.
roug
parents: 15
diff changeset
120 * Print the buffer
6aa54d3691e5 I needed to understand how OS9 does its memory housekeeping.
roug
parents: 15
diff changeset
121 *
6aa54d3691e5 I needed to understand how OS9 does its memory housekeeping.
roug
parents: 15
diff changeset
122 print pshs y,x,a
6aa54d3691e5 I needed to understand how OS9 does its memory housekeeping.
roug
parents: 15
diff changeset
123 lda #C$CR Add form feed to buffer
6aa54d3691e5 I needed to understand how OS9 does its memory housekeeping.
roug
parents: 15
diff changeset
124 bsr ApndA
6aa54d3691e5 I needed to understand how OS9 does its memory housekeeping.
roug
parents: 15
diff changeset
125 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
126 stx <bufptr
6aa54d3691e5 I needed to understand how OS9 does its memory housekeeping.
roug
parents: 15
diff changeset
127 ldy #80 Max line length = 80
6aa54d3691e5 I needed to understand how OS9 does its memory housekeeping.
roug
parents: 15
diff changeset
128 lda #stdout
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
129 os9 I$WritLn
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
130 puls pc,y,x,a
90
6aa54d3691e5 I needed to understand how OS9 does its memory housekeeping.
roug
parents: 15
diff changeset
131 *
6aa54d3691e5 I needed to understand how OS9 does its memory housekeeping.
roug
parents: 15
diff changeset
132 * Appends the content of register B in decimal
6aa54d3691e5 I needed to understand how OS9 does its memory housekeeping.
roug
parents: 15
diff changeset
133 * to the buffer
6aa54d3691e5 I needed to understand how OS9 does its memory housekeeping.
roug
parents: 15
diff changeset
134 *
6aa54d3691e5 I needed to understand how OS9 does its memory housekeeping.
roug
parents: 15
diff changeset
135 bDeci lda #$FF
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
136 clr <u0004
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
137 L0105 inca
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
138 subb #$64
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
139 bcc L0105
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
140 bsr L0119
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
141 lda #$0A
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
142 L010E deca
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
143 addb #$0A
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
144 bcc L010E
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
145 bsr L0119
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
146 tfr b,a
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
147 inc <u0004
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
148 L0119 tsta
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
149 beq L011E
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
150 sta <u0004
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
151 L011E tst <u0004
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
152 bne L0124
90
6aa54d3691e5 I needed to understand how OS9 does its memory housekeeping.
roug
parents: 15
diff changeset
153 aspace lda #$F0
6aa54d3691e5 I needed to understand how OS9 does its memory housekeeping.
roug
parents: 15
diff changeset
154 L0124 adda #$30 Offset to "0" in ascii table
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
155 cmpa #$3A
90
6aa54d3691e5 I needed to understand how OS9 does its memory housekeeping.
roug
parents: 15
diff changeset
156 bcs ApndA
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
157 adda #$07
90
6aa54d3691e5 I needed to understand how OS9 does its memory housekeeping.
roug
parents: 15
diff changeset
158 *
6aa54d3691e5 I needed to understand how OS9 does its memory housekeeping.
roug
parents: 15
diff changeset
159 * Append character (in a) to buffer
6aa54d3691e5 I needed to understand how OS9 does its memory housekeeping.
roug
parents: 15
diff changeset
160 *
6aa54d3691e5 I needed to understand how OS9 does its memory housekeeping.
roug
parents: 15
diff changeset
161 ApndA pshs x
6aa54d3691e5 I needed to understand how OS9 does its memory housekeeping.
roug
parents: 15
diff changeset
162 ldx <bufptr
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
163 sta ,x+
90
6aa54d3691e5 I needed to understand how OS9 does its memory housekeeping.
roug
parents: 15
diff changeset
164 stx <bufptr
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
165 puls pc,x
90
6aa54d3691e5 I needed to understand how OS9 does its memory housekeeping.
roug
parents: 15
diff changeset
166 *
6aa54d3691e5 I needed to understand how OS9 does its memory housekeeping.
roug
parents: 15
diff changeset
167 * Append register D as hex string to buffer
6aa54d3691e5 I needed to understand how OS9 does its memory housekeeping.
roug
parents: 15
diff changeset
168 *
6aa54d3691e5 I needed to understand how OS9 does its memory housekeeping.
roug
parents: 15
diff changeset
169 dHexa clr <u0004
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
170 bsr L013C
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
171 tfr b,a
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
172 L013C pshs a
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
173 lsra
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 bsr L0146
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
178 puls a
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
179 L0146 anda #$0F
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
180 bra L0119
90
6aa54d3691e5 I needed to understand how OS9 does its memory housekeeping.
roug
parents: 15
diff changeset
181 display pshs y,x
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
182 leay >L0048,pcr
90
6aa54d3691e5 I needed to understand how OS9 does its memory housekeeping.
roug
parents: 15
diff changeset
183 bsr ApndStr
6aa54d3691e5 I needed to understand how OS9 does its memory housekeeping.
roug
parents: 15
diff changeset
184 lda #stdout
15
0912ac5dc2ff Added initial and dates to some source files
boisy
parents: 0
diff changeset
185 ldb #SS.DStat
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
186 os9 I$GetStt
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
187 bcc L0163
90
6aa54d3691e5 I needed to understand how OS9 does its memory housekeeping.
roug
parents: 15
diff changeset
188 leay >notalloc,pcr
6aa54d3691e5 I needed to understand how OS9 does its memory housekeeping.
roug
parents: 15
diff changeset
189 bsr ApndStr
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
190 bra L016E
90
6aa54d3691e5 I needed to understand how OS9 does its memory housekeeping.
roug
parents: 15
diff changeset
191 L0163 leay >ataddr,pcr
6aa54d3691e5 I needed to understand how OS9 does its memory housekeeping.
roug
parents: 15
diff changeset
192 lbsr ApndStr
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
193 tfr x,d
90
6aa54d3691e5 I needed to understand how OS9 does its memory housekeeping.
roug
parents: 15
diff changeset
194 bsr dHexa
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
195 L016E puls y,x
90
6aa54d3691e5 I needed to understand how OS9 does its memory housekeeping.
roug
parents: 15
diff changeset
196 lbra print
15
0912ac5dc2ff Added initial and dates to some source files
boisy
parents: 0
diff changeset
197
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
198 emod
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
199 eom equ *
15
0912ac5dc2ff Added initial and dates to some source files
boisy
parents: 0
diff changeset
200 end
0912ac5dc2ff Added initial and dates to some source files
boisy
parents: 0
diff changeset
201