annotate level2/cmds/pmap.asm @ 1500:b00cf13c9f61

Major changes for new NitrOS-9 manual
author boisy
date Mon, 05 Jan 2004 00:51:19 +0000
parents 8e90ef1b670e
children 88e86510c192
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1 ********************************************************************
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
2 * PMap - Show process map information
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 * From "Inside Level II" by Kevin Darling
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
7 *
1255
bf6f854a4299 Changed revisions to 0
boisy
parents: 0
diff changeset
8 * Edt/Rev YYYY/MM/DD Modified by
bf6f854a4299 Changed revisions to 0
boisy
parents: 0
diff changeset
9 * Comment
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
10 * ------------------------------------------------------------------
1255
bf6f854a4299 Changed revisions to 0
boisy
parents: 0
diff changeset
11 * ? 1987/02/08 Kevin Darling
bf6f854a4299 Changed revisions to 0
boisy
parents: 0
diff changeset
12 * Original version.
bf6f854a4299 Changed revisions to 0
boisy
parents: 0
diff changeset
13 *
bf6f854a4299 Changed revisions to 0
boisy
parents: 0
diff changeset
14 * 2 1989/09/12 Ken Drexler
1350
8e90ef1b670e Rolled into Level 1 unlink.asm
boisy
parents: 1255
diff changeset
15 * Revised to handle 4K or 8K blocks.
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
16
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
17 nam PMap
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
18 ttl Show process map information
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
19
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
20 ifp1
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
21 use defsfile
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
22 endc
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
23
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
24 Type set Prgrm+Objct
1255
bf6f854a4299 Changed revisions to 0
boisy
parents: 0
diff changeset
25 Revs set ReEnt+0
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
26 Bufsiz set 512
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
27 edition set 2
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
28
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
29 stdout set 1
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
30 maxnam set 30
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
31
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
32 pag
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
33 ***************************************************
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
34 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
35 mod PrgSiz,Name,Type,Revs,Entry,DatSiz
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
36
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
37 Name fcs /PMap/
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
38 fcb edition
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
39
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
40 * Data Equates
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
41 umem rmb 2
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
42 sysImg rmb 2 pointer to sysprc datimg
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
43 datimg rmb 2 datimg for copymem
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
44 lineptr rmb 2
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
45 number rmb 3
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
46 leadflag rmb 1
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
47 pid rmb 1
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
48 hdr rmb 12
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
49 blkcnt rmb 1 no. blocks/64k
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
50 outbuf rmb 80
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
51 buffer rmb bufsiz*2 working proc. desc.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
52 stack rmb 200
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
53 datsiz equ .
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
54
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
55 *************************************************
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
56 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
57 * Messages
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
58 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
59 Head1A fcc / ID 01 23 45 67 89 AB CD EF Program /
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
60 fcb C$CR
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
61
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
62 Head2A fcc /____ __ __ __ __ __ __ __ __ ___________/
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
63 Hdrcr fcb C$CR
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
64
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
65 Head1B fcc / ID 0 1 2 3 4 5 6 7 8 9 A B C D E F Program/
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
66 fcb C$CR
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
67
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
68 Head2B fcc /____ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ _______/
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
69 fcb C$CR
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
70
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
71 SysNam fcs "SYSTEM"
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
72 syslen equ *-Sysnam
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
73
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
74 spc 3
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
75 ***************************************************
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
76 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
77 Entry stu Umem
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
78 lda #1 start with process 1
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
79 clr Pid
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
80
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
81 * Print header
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
82 leax buffer,u point at storage
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
83 os9 F$GBlkMp get block info
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
84 bcs Error
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
85 cmpd #8192 8k?
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
86 beq Set8k
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
87 cmpd #4096 4k?
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
88 beq Set4k
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
89 bra Error we only do 4k/8k
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
90
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
91 Set8k lda #64/8
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
92 bra Entry1
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
93
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
94 Set4k lda #64/4
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
95 Entry1 sta blkcnt save size
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
96 leax Hdrcr,pcr print line
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
97 lbsr PrintL1 print it
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
98 lda blkcnt
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
99 cmpa #64/4 4k?
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
100 beq Headr4
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
101 Headr8 leax Head1A,pcr
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
102 lbsr PrintL1 print it
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
103 leax Head2A,pcr
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
104 bra Head41
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
105
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
106 Headr4 leax Head1B,pcr
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
107 lbsr PrintL1
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
108 leax Head2B,pcr
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
109 Head41 lbsr PrintL1
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
110
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
111 * Main Program Loop
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
112 Main ldu umem
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
113 leax OutBuf,U set line pointer
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
114 stx Lineptr
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
115 inc Pid next process
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
116 beq Bye >= 255 --> exit
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
117 lda Pid get proc id
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
118 leax Buffer,U set destination
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
119 os9 F$GPrDsc
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
120 bcs Main loop if no descriptor
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
121 bsr Output print data for descriptor
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
122 bra Main
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
123
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
124 Bye clrb
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
125 Error os9 F$Exit
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
126
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
127 * Subroutines
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
128
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
129 Output lda P$ID,X process id
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
130 lbsr Outdecl
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
131 lbsr Space
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
132 lbsr Space
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
133
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
134 * Print Process DAT Image
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
135 * IN: x = process descriptor
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
136 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
137 pshs X
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
138 leax P$DATImg,x point to DAT image
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
139 ldb blkcnt set count
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
140 pshs b
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
141
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
142 PrntImg ldd ,x++ get DAT block
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
143 cmpd #$00FC empty?
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
144 bne prntimg2
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
145 ldy lineptr
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
146 ldd #"..
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
147 std ,y++
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
148 sty lineptr
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
149 lbsr space
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
150 bra prntimg3
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
151
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
152 PrntImg2 tfr b,a print block no.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
153 lbsr Out2HS
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
154
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
155 PrntImg3 dec ,s count -= 1
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
156 bne Prntimg
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
157 puls b,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
158
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
159 * Print primary module name
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
160 * IN: X - process descriptor
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
161 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
162 lbsr Space
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
163 leay P$DATImg,X
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
164 tfr Y,D d=dat image
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
165 std datimg save pointer
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
166 ldx P$PModul,X x=offset in map
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
167 bne doname
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
168 leax >sysnam,pcr point at name
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
169 ldy lineptr
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
170 ldb #syslen
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
171
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
172 Copy lda ,x+
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
173 sta ,y+
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
174 decb
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
175 bne copy
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
176 bsr Name2
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
177 bra Printlin
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
178
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
179 Doname bsr Printnam
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
180
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
181 * Print Line
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
182 Printlin ldx lineptr terminate line
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
183 lda #C$CR
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
184 sta ,X
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
185 ldu umem
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
186 leax outbuf,U
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
187
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
188 * Print line
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
189 PrintL1 ldy #80
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
190 lda #stdout
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
191 os9 I$Writln
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
192 bcs Error
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
193 rts
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
194
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
195 ** Find and print a module name
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
196 * IN: X - module offset
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
197 * U - data area
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
198 * datimg = pointer
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
199 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
200 Printnam equ *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
201
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
202 * Read module header
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
203 pshs U save u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
204 leau hdr,U destination
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
205 ldd datimg proc datimg pointer
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
206 ldy #10 set length
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
207 os9 F$CpyMem
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
208 lbcs Error
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
209
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
210 * Read name from Module to buffer
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
211 ldd M$Name,U get name offset from header
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
212 ldu lineptr move name to outbuf
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
213 leax D,X X - offset to name
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
214 ldd datimg
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
215 ldy #maxnam set maximum length
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
216 os9 F$CpyMem
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
217 puls U
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
218 lbcs Error
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
219
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
220 Name2 pshs X
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
221 ldx lineptr
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
222 clrb set length = 0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
223 Name3 incb
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
224 lda ,X+
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
225 bpl Name3
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
226 cmpb #40
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
227 bcc Name5
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
228 anda #$7F clear d7
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
229 sta -1,X
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
230 cmpb #9
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
231 bcc Name5
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
232 lda #C$SPAC
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
233 Name4 sta ,X+
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
234 incb
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
235 cmpb #9
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
236 bcs Name4
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
237 Name5 stx lineptr
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
238 puls X,PC
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
239
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
240 * Print hex digit in A
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
241 Out2HS bsr Hexl
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
242
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
243 Space lda #C$SPAC
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
244 bra Print
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
245
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
246
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
247 * Print Hexidecimal Digit in A
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
248 Hexl tfr A,B
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
249 lsra
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
250 lsra
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
251 lsra
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
252 lsra
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
253 bsr Outhex
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
254 tfr B,A
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
255 Outhex anda #$0F
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
256 cmpa #$0A 0 - 9
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
257 bcs Outdig
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
258 adda #$07 A - F
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
259 Outdig adda #'0 make ASCII
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
260
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
261 * Put character in A in buf
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
262 Print pshs X
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
263 ldx lineptr
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
264 sta ,X+
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
265 stx lineptr
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
266 puls X,PC
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
267
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
268 * Print 1 Decimal Digit in A
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
269 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
270 Outdecl tfr A,B number to B
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
271 clra
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
272
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
273 * Print 2 Decimal Digits in D
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
274 Outdec clr leadflag
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
275 pshs X
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
276 ldx umem
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
277 leax number,X
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
278 clr ,X
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
279 clr 1,X
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
280 clr 2,X
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
281 Hundred inc ,X
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
282 subd #100
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
283 bcc Hundred
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
284 addd #100
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
285 Ten inc 1,X
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
286 subd #10
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
287 bcc Ten
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
288 addd #10
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
289 incb
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
290 stb 2,X
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
291 bsr Printled
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
292 bsr Printled
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
293 bsr Printnum
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
294 bsr Space
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
295 puls X,PC
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
296
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
297 Printnum lda ,X+ get char
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
298 adda #'0-1 make ASCII
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
299 bra Print
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
300
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
301 Printled tst leadflag print leading zero?
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
302 bne Printnum yes
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
303 ldb ,X is it zero?
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
304 inc leadflag
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
305 decb
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
306 bne Printnum no, print zeros
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
307 clr leadflag
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
308 lda #C$SPAC
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
309 leax 1,X
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
310 bra Print
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
311
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
312 emod
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
313 Prgsiz equ *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
314 end