comparison level2/modules/krnp4_regdump.asm @ 1748:949d4df97cca

Fixed some comments, made better use of symbolics
author boisy
date Thu, 03 Mar 2005 23:19:49 +0000
parents 08c3460dab82
children 6ccd6e25a441
comparison
equal deleted inserted replaced
1747:d588589fc0e0 1748:949d4df97cca
6 * Copyright February,1989 by Ron Lammardo 6 * Copyright February,1989 by Ron Lammardo
7 * 7 *
8 * This system call can be used in an application program to dump the 8 * This system call can be used in an application program to dump the
9 * current contents of all user registers in Hex,Decimal,Binary and Ascii 9 * current contents of all user registers in Hex,Decimal,Binary and Ascii
10 * (Registers "A" and "B" Only). This module MUST be present in the 10 * (Registers "A" and "B" Only). This module MUST be present in the
11 * bootfile. If no KernelP3 module is found,change the "mname" and "nextname" 11 * bootfile. If no krnp5 module is found,change the "mname" and "nextname"
12 * as appropriate. 12 * as appropriate.
13 * 13 *
14 * If there is a conflict with the code used for this system called, it can 14 * If there is a conflict with the code used for this system called, it can
15 * be changed by resetting the equate at "F$RegDmp" 15 * be changed by resetting the equate at "F$RegDmp"
16 * 16 *
28 28
29 ifp1 29 ifp1
30 use defsfile 30 use defsfile
31 endc 31 endc
32 32
33 tylg set systm+objct 33 tylg set Systm+Objct
34 atrv set reent+revision 34 atrv set ReEnt+revision
35 revision set 0 35 revision set 0
36 edition set 1 36 edition set 1
37 37
38 mod eom,name,tylg,atrv,start,0 38 mod eom,name,tylg,atrv,start,0
39 39
52 bcs endsetup no good...skip this 52 bcs endsetup no good...skip this
53 jsr ,y else go execute it 53 jsr ,y else go execute it
54 endsetup rts return back to previous module 54 endsetup rts return back to previous module
55 55
56 nextname fcc /krnp5/ next module name to link to 56 nextname fcc /krnp5/ next module name to link to
57 fcb $0d 57 fcb C$CR
58 58
59 regdmp equ * 59 regdmp equ *
60 IFNE H6309 60 IFNE H6309
61 pshs cc,a,b,e,f,dp,x,y,u save all registers 61 pshs cc,a,b,e,f,dp,x,y,u save all registers
62 ELSE 62 ELSE
64 ENDC 64 ENDC
65 tfr u,y transfer addresses 65 tfr u,y transfer addresses
66 leas -60,s back up for some variable storage 66 leas -60,s back up for some variable storage
67 leau 4,s buffer starts here 67 leau 4,s buffer starts here
68 clr ,u+ set flag to print ascii char 68 clr ,u+ set flag to print ascii char
69 lda #$20 get a space 69 lda #C$SPAC get a space
70 ldb #50 number of chars to clear 70 ldb #50 number of chars to clear
71 tfr u,x set register for loop 71 tfr u,x set register for loop
72 72
73 clrloop sta ,x+ initialize a space 73 clrloop sta ,x+ initialize a space
74 decb decrement counter 74 decb decrement counter
99 bsr reg000 dump register DP 99 bsr reg000 dump register DP
100 ldd R$PC,y get user Task Number 100 ldd R$PC,y get user Task Number
101 bsr reg000 dump register PC 101 bsr reg000 dump register PC
102 ldy <D.Proc get address of users process descriptor 102 ldy <D.Proc get address of users process descriptor
103 ldd P$SP,y get users stack address 103 ldd P$SP,y get users stack address
104 IFNE H6309 104 addd #R$Size add on for registers which were saved
105 addd #14 add on for registers which were saved
106 ELSE
107 addd #12 add on for registers which were saved
108 ENDC
109 bsr reg000 dump register S 105 bsr reg000 dump register S
110 lbsr reg060 send a <CR> 106 lbsr reg060 send a <CR>
111 leas 60,s restore stack pointer 107 leas 60,s restore stack pointer
112 IFNE H6309 108 IFNE H6309
113 puls cc,a,b,e,f,dp,x,y,u,pc restore all registers and return 109 puls cc,a,b,e,f,dp,x,y,u,pc restore all registers and return
132 lbsr gethex convert to hex 128 lbsr gethex convert to hex
133 tst 0,s 1 byte ? 129 tst 0,s 1 byte ?
134 bne reg010 no...skip this 130 bne reg010 no...skip this
135 ldd 2,u get 2 lsb's 131 ldd 2,u get 2 lsb's
136 std ,u store in msb's 132 std ,u store in msb's
137 ldd #$2020 get two blanks 133 ldd #C$SPAC*256+C$SPAC get two spaces
138 std 2,u store in lsb's 134 std 2,u store in lsb's
139 135
140 reg010 ldd #$2023 get a space and "#" 136 reg010 ldd #C$SPAC*256+'# get a space and "#"
141 std 4,u move in two spaces 137 std 4,u move in two spaces
142 leau 6,u point to start of decimal output buffer 138 leau 6,u point to start of decimal output buffer
143 ldd 3,s get register 139 ldd 3,s get register
144 lbsr getdec convert to decimal 140 lbsr getdec convert to decimal
145 tst 0,s is it one byte 141 tst 0,s is it one byte
146 bne reg020 no..skip this 142 bne reg020 no..skip this
147 ldd 2,u else get third & fourth chars 143 ldd 2,u else get third & fourth chars
148 std ,u store as first two 144 std ,u store as first two
149 lda 4,u get fifth char 145 lda 4,u get fifth char
150 sta 2,u store as third 146 sta 2,u store as third
151 ldd #$2020 get two spaces 147 ldd #C$SPAC*256+C$SPAC get two spaces
152 std 3,u store as 4th & 5th chars 148 std 3,u store as 4th & 5th chars
153 149
154 reg020 ldd #$2025 get a blank & "%" 150 reg020 ldd #C$SPAC*256+'% get a blank & "%"
155 std 5,u move it to buffer 151 std 5,u move it to buffer
156 leau 7,u point to start of binary output area 152 leau 7,u point to start of binary output area
157 tfr a,b space in 'b' 153 tfr a,b space in 'b'
158 std 16,u space out ascii char 154 std 16,u space out ascii char
159 ldd 3,s get register 155 ldd 3,s get register
162 bne reg040 skip if two bytes 158 bne reg040 skip if two bytes
163 ldb #8 loop counter 159 ldb #8 loop counter
164 160
165 reg030 lda 8,u get two chars from second 8 digits 161 reg030 lda 8,u get two chars from second 8 digits
166 sta ,u+ store in first 8 digits 162 sta ,u+ store in first 8 digits
167 lda #$20 get two blanks 163 lda #C$SPAC get space
168 sta 7,u store in second 8 digits 164 sta 7,u store in second 8 digits
169 decb decrement counter 165 decb decrement counter
170 bne reg030 loop back if not done 166 bne reg030 loop back if not done
171 leau -8,u back up to beginning of binary digit output 167 leau -8,u back up to beginning of binary digit output
172 ldb 4,s get lsb of register 168 ldb 4,s get lsb of register
173 tst -18,u check if we want to print ascii char 169 tst -18,u check if we want to print ascii char
174 bne reg040 nope..skip this 170 bne reg040 nope..skip this
175 cmpb #$20 compare char with space 171 cmpb #C$SPAC compare char with space
176 blo reg040 if lower..skip this 172 blo reg040 if lower..skip this
177 cmpb #'z compare with last alpha char 173 cmpb #'z compare with last alpha char
178 bhi reg040 if higher..skip this 174 bhi reg040 if higher..skip this
179 stb 17,u else store the char 175 stb 17,u else store the char
180 176
184 bsr reg070 send it 180 bsr reg070 send it
185 clra clear msb for next reg 181 clra clear msb for next reg
186 puls b,x,y,u restore registers 182 puls b,x,y,u restore registers
187 puls y,pc restore y & return 183 puls y,pc restore y & return
188 184
189 reg050 fcb $0d 185 reg050 fcb C$CR
190 186
191 reg060 leax <reg050,pcr point to <cr> 187 reg060 leax <reg050,pcr point to <cr>
192 188
193 reg070 pshs x,y,u,a,b save registers 189 reg070 pshs x,y,u,a,b save registers
194 ldy <D.Proc get process descriptor address 190 ldy <D.Proc get process descriptor address
316 inc ,s increment digit counter 312 inc ,s increment digit counter
317 bra gtd020 and loop back 313 bra gtd020 and loop back
318 314
319 gtd030 std 1,s save remainder of number 315 gtd030 std 1,s save remainder of number
320 ldb ,s+ get counter 316 ldb ,s+ get counter
321 addb #$30 make it ascii 317 addb #'0 make it ascii
322 stb ,u+ and move it as output 318 stb ,u+ and move it as output
323 puls d,pc restore remainder & return 319 puls d,pc restore remainder & return
324 320
325 emod 321 emod
326 eom equ * 322 eom equ *