Mercurial > hg > Members > kono > nitros9-code
annotate lib/alib/sho_regs.as @ 2989:5944d79e3fe5
sysgo: Update copyright year
author | Tormod Volden <debian.tormod@gmail.com> |
---|---|
date | Sun, 13 Apr 2014 21:19:25 +0200 |
parents | 03f26e88b809 |
children |
rev | line source |
---|---|
2474 | 1 ************************************ |
2 | |
3 * Display the 6809 registers to standard error | |
4 | |
5 * OTHER MODULES NEEDED: BIN2HEX, BIN_HEX, PUTS | |
6 | |
7 | |
8 * ENTRY: none | |
9 * EXIT: none | |
10 | |
11 | |
12 * NOTE: The value used for PC is that of the calling routine | |
13 * S is assumed to be 2 greater than actual to comp for | |
14 * the subroutine call... | |
15 | |
16 | |
17 nam Show Register Values | |
18 ttl Assembler Library Module | |
19 | |
20 | |
2782
aaba193af04f
Updated code to use lwasm/lwlink
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2474
diff
changeset
|
21 section .data |
2474 | 22 |
23 count rmb 1 counter for 9 regs. | |
24 buffer rmb 8 buffer for ascii strings | |
25 cc.r rmb 1 offsets to access values | |
26 a.r rmb 1 | |
27 b.r rmb 1 | |
28 dp.r rmb 1 | |
29 x.r rmb 2 | |
30 y.r rmb 2 | |
31 u.r rmb 2 | |
32 s.r rmb 2 | |
33 pc.r rmb 2 | |
34 | |
35 endsect | |
36 | |
2782
aaba193af04f
Updated code to use lwasm/lwlink
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2474
diff
changeset
|
37 section .text |
aaba193af04f
Updated code to use lwasm/lwlink
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2474
diff
changeset
|
38 |
2474 | 39 SHO_REGS: |
40 leas -2,s room for copy of <S> | |
41 pshs cc,a,b,dp,x,y,u save rest | |
42 leas -cc.r,s room for ascii strings | |
43 tfr s,x | |
44 leax pc.r,x get old <S> | |
45 stx s.r,s stick on stack | |
46 leay cc.r,s point to regs | |
47 leau text,pcr register names | |
48 clr count,s int. counter | |
49 | |
50 * now we loop and display all the registers | |
51 | |
52 loop1 | |
53 leax buffer,s point to ascii buffer | |
54 ldd ,u++ get reg. name | |
55 std ,x++ | |
56 lda #'= add a "=" | |
57 sta ,x+ | |
58 lda count,s 1st 4 are 1 byte | |
59 cmpa #4 | |
60 bhs loop2 no, do a 2byte | |
61 ldb ,y+ get single value | |
62 lbsr BIN2HEX | |
63 std ,x save ascii number | |
64 clr 2,x | |
65 bra report go report | |
66 loop2 | |
67 cmpa #9 done all? | |
68 bhs exit yes, go home | |
69 ldd ,y++ get reg value | |
70 lbsr BIN_HEX convert it | |
71 | |
72 * report reg. value | |
73 | |
74 report | |
75 leax buffer,s start of buffer | |
76 lda #2 std err | |
77 lbsr FPUTS print it | |
78 ldb #$20 space | |
79 lbsr FPUTC | |
80 inc count,s do next reg | |
81 bra loop1 | |
82 | |
83 exit | |
84 ldb #$0d | |
85 lda #2 | |
86 lbsr FPUTC start new line | |
87 leas cc.r,s clear up stack | |
88 puls cc,a,b,dp,x,y,u | |
89 leas 2,s | |
90 rts go home | |
91 | |
92 text | |
93 fcc /cc/ | |
94 fcc / a/ | |
95 fcc / b/ | |
96 fcc /dp/ | |
97 fcc / x/ | |
98 fcc / y/ | |
99 fcc / u/ | |
100 fcc / s/ | |
101 fcc /pc/ | |
102 | |
103 endsect |