Disassembler in Action
I have a mechanism for attaching the disassembler to the breakpoint prompt. The applet in bank 1 has to have the disassember code because it’s too big to fit with everything in bank 0. So, the address of the function is placed at 0x0024 and if that location is not 0, it is called. This has to be registered in main, so when the breakpoint occurs at the beginning of main, the disassember is not hooked up yet. But, see the output below. Once the debugger gets to 4074 disassembly is possible. The command is ‘z’ with optional number of instructions and then an optional start address. I still have a lot of diagnostic stuff in the breakpoint code that I’m ready to remove (e.g. “Set BP0 @ 4062 (6-0)” and “RST 20 to dd @ 4066”).
1 Mark Hamann's Z80 Computer
2 App Build: 20:59:21 Oct 1 2015
3 BSP Build: 20:59:19 Oct 1 2015
4 C Lib Build: 20:08:20 Sep 30 2015
5 Menu
6 1: dir
7 2: run applet
8 3: program intel hex
9 4: utils menu
10 5: drivers menu
11 > 3
12 In IHX program mode. Ensure that HW flow control is on.
13 Flash bank to program (0-f)? 4
14 Is this an applet (y/n)? n
15 Not erased. Erase (y/n)? y
16 Now, paste the .ihx contents
17 The mode will end on the :00000001FF
18 ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffDone!
19 > 2
20 Applet bank? (2-f)? c
21 Loading C vector bank 4 and applet bank c for version 0103 (ok=0)
22 Flash to RAM...
23 Prepping banks...
24 About to jump...
25 Set BP0 @ 4060 (6-0)
26 RST 20 to dd @ 4060
27 Breaking at main()
28 4060 e7
29 RST 20 from dd @ 4060
30 (brk @ 4060)> n
31 branch 00
32 Set BP0 @ 4062 (6-0)
33 RST 20 to dd @ 4062
34 RST 20 from dd @ 4062
35 (brk @ 4062)>
36 (brk @ 4062)> n
37 branch 00
38 Set BP0 @ 4066 (6-0)
39 RST 20 to dd @ 4066
40 RST 20 from dd @ 4066
41 (brk @ 4066)> n
42 branch 00
43 Set BP0 @ 4068 (6-0)
44 RST 20 to 21 @ 4068
45 RST 20 from 21 @ 4068
46 (brk @ 4068)> n
47 branch 00
48 Set BP0 @ 406b (6-0)
49 RST 20 to 39 @ 406b
50 RST 20 from 39 @ 406b
51 (brk @ 406b)> n
52 branch 00
53 Set BP0 @ 406c (6-0)
54 RST 20 to f9 @ 406c
55 RST 20 from f9 @ 406c
56 (brk @ 406c)> n
57 branch 00
58 Set BP0 @ 406d (6-0)
59 RST 20 to 21 @ 406d
60 RST 20 from 21 @ 406d
61 (brk @ 406d)> n
62 branch 00
63 Set BP0 @ 4070 (6-0)
64 RST 20 to e5 @ 4070
65 RST 20 from e5 @ 4070
66 (brk @ 4070)> z
67 (brk @ 4070)> n
68 branch 00
69 Set BP0 @ 4071 (6-0)
70 RST 20 to cd @ 4071
71 RST 20 from cd @ 4071
72 (brk @ 4071)> z
73 (brk @ 4071)> n
74 branch 18
75 Set BP0 @ 4074 (6-0)
76 RST 20 to 21 @ 4074
77 RST 20 from 21 @ 4074
78 (brk @ 4074)> z
79 4074: ld hl, 8080h
80 4077: ex (sp), hl
81 4078: call 3f23h
82 407b: pop af
83 407c: call 3f1dh
84 407f: ld hl, 007fh
85 4082: push hl
86 4083: call 3f11h
87 (brk @ 4074)> z 10 0
88 0: jp 0069h
89 3: rst 38h
90 4: rst 38h
91 5: rst 38h
92 6: rst 38h
93 7: rst 38h
94 8: jp 0db1h
95 b: rst 38h
96 c: rst 38h
97 d: rst 38h
98 e: rst 38h
99 f: rst 38h
100 10: jp 0dc2h
101 13: rst 38h
102 14: rst 38h
103 15: rst 38h
104 (brk @ 4074)> n
105 branch 00
106 Set BP0 @ 4077 (6-0)
107 RST 20 to e3 @ 4077
108 RST 20 from e3 @ 4077
109 (brk @ 4077)> z
110 4077: ex (sp), hl
111 4078: call 3f23h
112 407b: pop af
113 407c: call 3f1dh
114 407f: ld hl, 007fh
115 4082: push hl
116 4083: call 3f11h
117 4086: pop af
118 (brk @ 4077)> n
119 branch 00
120 Set BP0 @ 4078 (6-0)
121 RST 20 to cd @ 4078
122 RST 20 from cd @ 4078
123 (brk @ 4078)> n
124 branch 18
125 Set BP0 @ 407b (6-0)
126 RST 20 to f1 @ 407b
127 RST 20 from f1 @ 407b
128 (brk @ 407b)> z
129 407b: pop af
130 407c: call 3f1dh
131 407f: ld hl, 007fh
132 4082: push hl
133 4083: call 3f11h
134 4086: pop af
135 4087: ld hl, 0000h
136 408a: add hl, sp
137 (brk @ 407b)> c
138 branch 00
139 Set BP0 @ 407c (a-1)
140 RST 20 to cd @ 407c
141 RST 20 from cd @ 407c
OK, I cleaned up the diagnostic stuff. Here is what it looks like now:
1 Menu
2 1: dir
3 2: run applet
4 3: program intel hex
5 4: utils menu
6 5: drivers menu
7 > 3
8 In IHX program mode. Ensure that HW flow control is on.
9 Flash bank to program (0-f)? 4
10 Is this an applet (y/n)? n
11 Not erased. Erase (y/n)? y
12 Now, paste the .ihx contents
13 The mode will end on the :00000001FF
14 fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffDone!
15 > 2
16 Applet bank? (2-f)? c
17 Loading C vector bank 4 and applet bank c for version 0103 (ok=0)
18 Flash to RAM...
19 Prepping banks...
20 About to jump...
21 Breaking at main()
22 4060 e7
23 (brk @ 4060)> n
24 (brk @ 4062)> n
25 (brk @ 4066)> n
26 (brk @ 4068)> n
27 (brk @ 406b)> n
28 (brk @ 406c)> n
29 (brk @ 406d)> n
30 (brk @ 4070)> n
31 (brk @ 4071)> n
32 (brk @ 4074)> n
33 (brk @ 4077)> z
34 4077: ex (sp), hl
35 4078: call 3f23h
36 407b: pop af
37 407c: call 3f1dh
38 407f: ld hl, 007fh
39 4082: push hl
40 4083: call 3f11h
41 4086: pop af
42 (brk @ 4077)> n
43 (brk @ 4078)> n
44 (brk @ 407b)> n
45 (brk @ 407c)> n
46 (brk @ 407f)> n
47 (brk @ 4082)> n
48 (brk @ 4083)> n
49 (brk @ 4086)> z
50 4086: pop af
51 4087: ld hl, 0000h
52 408a: add hl, sp
53 408b: ld d, l
54 408c: ld e, h
55 408d: ld bc, 40c7h
56 4090: push hl
57 4091: push de
58 (brk @ 4086)>