-
Notifications
You must be signed in to change notification settings - Fork 0
/
diagnostics-3.html
284 lines (241 loc) · 20.1 KB
/
diagnostics-3.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>fritzm.github.io - PDP-11/45: Diagnostics III - CKBME0</title>
<meta name="description" content="">
<meta name="author" content="Fritz Mueller">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- Le HTML5 shim, for IE6-8 support of HTML elements -->
<!--[if lt IE 9]>
<script src="https://fritzm.github.io/theme/html5.js"></script>
<![endif]-->
<!-- Le styles -->
<link href="https://fritzm.github.io/theme/bootstrap.min.css" rel="stylesheet">
<link href="https://fritzm.github.io/theme/bootstrap.min.responsive.css" rel="stylesheet">
<link href="https://fritzm.github.io/theme/local.css" rel="stylesheet">
<link href="https://fritzm.github.io/theme/pygments.css" rel="stylesheet">
<!-- Photoswipe -->
<link rel="stylesheet" href="https://fritzm.github.io/theme/photoswipe.css">
<link rel="stylesheet" href="https://fritzm.github.io/theme/default-skin/default-skin.css">
<script src="https://fritzm.github.io/theme/photoswipe.min.js"></script>
<script src="https://fritzm.github.io/theme/photoswipe-ui-default.min.js"></script>
<script src="https://fritzm.github.io/galleries.js"></script>
<script type="text/javascript">
var pswipe = function(gname, index) {
var pswpElement = document.querySelectorAll('.pswp')[0];
var items = galleries[gname];
var options = { index: index };
var gallery = new PhotoSwipe(pswpElement, PhotoSwipeUI_Default, items, options);
gallery.init();
};
</script>
<!-- So Firefox can bookmark->"abo this site" -->
<link href="https://fritzm.github.io/feeds/all.rss.xml" rel="alternate" title="fritzm.github.io" type="application/rss+xml">
</head>
<body>
<div class="navbar">
<div class="navbar-inner">
<div class="container">
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<a class="brand" href="https://fritzm.github.io">fritzm.github.io</a>
<div class="nav-collapse">
<ul class="nav">
</ul>
</div>
</div>
</div>
</div>
<div class="container">
<div class="content">
<div class="row">
<div class="span9">
<div class='article'>
<div class="content-title">
<h1>PDP-11/45: Diagnostics III - CKBME0</h1>
Sat 09 July 2016
by <a class="url fn" href="https://fritzm.github.io/author/fritz-mueller.html">Fritz Mueller</a>
</div>
<div><p>Okay, digging into the CKBME0 traps diagnostic now in more detail. Here I've transcribed the source of the failing
test from the older available diagnostic listing, then re-assembled it at the address matching the more modern
binary. This makes it a little easier to follow along while debugging the newer binary:</p>
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre> 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30</pre></div></td><td class="code"><div class="highlight"><pre><span></span><span class="nt">013604</span> <span class="nt">000230</span> <span class="nt">SPL</span> <span class="nt">0</span> <span class="o">;</span><span class="nt">SET</span> <span class="nt">PRIORITY</span> <span class="nt">LEVEL</span> <span class="nt">0</span>
<span class="nt">013606</span> <span class="nt">012706</span> <span class="nt">000500</span> <span class="nt">MOV</span> <span class="p">#</span><span class="nn">STKPTR</span><span class="o">,%</span><span class="nt">6</span> <span class="o">;</span><span class="nt">SET</span> <span class="nt">STACK</span> <span class="nt">PTR</span>
<span class="nt">013612</span> <span class="nt">012737</span> <span class="nt">013650</span> <span class="nt">000064</span> <span class="nt">MOV</span> <span class="p">#</span><span class="nn">TTY7A</span><span class="o">,@</span><span class="p">#</span><span class="nn">TPVEC</span> <span class="o">;</span><span class="nt">LOAD</span> <span class="nt">TTY</span> <span class="nt">INTERRUPT</span> <span class="nt">VECTOR</span>
<span class="nt">013620</span> <span class="nt">012737</span> <span class="nt">013644</span> <span class="nt">000014</span> <span class="nt">MOV</span> <span class="p">#</span><span class="nn">TTY7B</span><span class="o">,@</span><span class="p">#</span><span class="nn">BPTVEC</span> <span class="o">;</span><span class="nt">LOAD</span> <span class="s1">'T'</span> <span class="nt">BIT</span> <span class="nt">TRAP</span> <span class="nt">VECTOR</span>
<span class="nt">013626</span> <span class="nt">005002</span> <span class="nt">CLR</span> <span class="o">%</span><span class="nt">2</span> <span class="o">;</span><span class="nt">CLEAR</span> <span class="nt">INDICATOR</span>
<span class="nt">013630</span> <span class="nt">052737</span> <span class="nt">000100</span> <span class="nt">177564</span> <span class="nt">BIS</span> <span class="p">#</span><span class="nn">100</span><span class="o">,@</span><span class="p">#</span><span class="nn">TTCSR</span> <span class="o">;</span><span class="nt">ALLOW</span> <span class="nt">INTERRUPT</span> <span class="nt">INTERRUPT</span> <span class="nt">OCCURS</span> <span class="nt">AFTER</span>
<span class="o">;</span><span class="nt">THIS</span> <span class="nt">INSTRUCTION</span> <span class="o">&</span> <span class="nt">BEFORE</span> <span class="nt">NEXT</span>
<span class="nt">013636</span> <span class="nt">000001</span> <span class="nt">WAIT1</span><span class="o">:</span> <span class="nt">WAIT</span> <span class="o">;</span><span class="nt">WAIT</span> <span class="nt">FOR</span> <span class="nt">AN</span> <span class="nt">INTERRUPT</span>
<span class="nt">013640</span> <span class="nt">005202</span> <span class="nt">INC</span> <span class="o">%</span><span class="nt">2</span> <span class="o">;</span><span class="nt">INCREMENT</span> <span class="nt">INDICATOR</span>
<span class="nt">013642</span> <span class="nt">000000</span> <span class="nt">HLT</span> <span class="o">;</span><span class="nt">ERROR</span><span class="o">!</span> <span class="nt">NO</span> <span class="s1">'T'</span> <span class="nt">TRAP</span> <span class="nt">AFTER</span> <span class="nt">INTERRUPT</span>
<span class="nt">013644</span> <span class="nt">000000</span> <span class="nt">TTY7B</span><span class="o">:</span> <span class="nt">HLT</span> <span class="o">;</span><span class="nt">ERROR</span><span class="o">!</span> <span class="s1">'T'</span> <span class="nt">BIT</span> <span class="nt">TRAPPED</span> <span class="nt">OUT</span> <span class="nt">OF</span> <span class="nt">WAIT</span>
<span class="nt">013646</span> <span class="nt">000424</span> <span class="nt">BR</span> <span class="nt">TTY7EX</span> <span class="o">;</span><span class="nt">EXIT</span> <span class="nt">TEST</span>
<span class="nt">013650</span> <span class="nt">012737</span> <span class="nt">000040</span> <span class="nt">177566</span> <span class="nt">TTY7A</span><span class="o">:</span> <span class="nt">MOV</span> <span class="p">#</span><span class="nn">40</span><span class="o">,@</span><span class="p">#</span><span class="nn">177566</span> <span class="o">;</span><span class="nt">TYPE</span> <span class="nt">SPACE</span> <span class="nt">CHAR</span>
<span class="nt">013656</span> <span class="nt">012737</span> <span class="nt">013674</span> <span class="nt">000064</span> <span class="nt">MOV</span> <span class="p">#</span><span class="nn">TTY7C</span><span class="o">,@</span><span class="p">#</span><span class="nn">TPVEC</span> <span class="o">;</span><span class="nt">REPOSITION</span> <span class="nt">TTY</span> <span class="nt">INT</span> <span class="nt">VECTOR</span>
<span class="nt">013664</span> <span class="nt">012766</span> <span class="nt">000020</span> <span class="nt">000002</span> <span class="nt">MOV</span> <span class="p">#</span><span class="nn">20</span><span class="o">,</span><span class="nt">2</span><span class="o">(</span><span class="nt">6</span><span class="o">)</span> <span class="o">;</span><span class="nt">PUT</span> <span class="s1">'T'</span> <span class="nt">BIT</span> <span class="nt">IN</span> <span class="nt">RETURN</span> <span class="nt">STATUS</span>
<span class="nt">013672</span> <span class="nt">000006</span> <span class="nt">RTT</span> <span class="o">;</span><span class="nt">RETURN</span> <span class="nt">TO</span> <span class="nt">WAIT</span> <span class="nt">WITH</span> <span class="s1">'T'</span> <span class="nt">BIT</span> <span class="nt">SET</span>
<span class="o">;</span><span class="nt">AND</span> <span class="nt">WAIT</span> <span class="nt">FOR</span> <span class="nt">TTY</span> <span class="nt">INTERRUPT</span> <span class="nt">WHEN</span> <span class="nt">NULL</span>
<span class="o">;</span><span class="nt">CHARACTER</span> <span class="nt">IS</span> <span class="nt">TYPED</span>
<span class="nt">013674</span> <span class="nt">012737</span> <span class="nt">013716</span> <span class="nt">000014</span> <span class="nt">TTY7C</span><span class="o">:</span> <span class="nt">MOV</span> <span class="p">#</span><span class="nn">TTY7D</span><span class="o">,@</span><span class="p">#</span><span class="nn">BPTVEC</span> <span class="o">;</span><span class="nt">REPOINT</span> <span class="s1">'T'</span> <span class="nt">BIT</span> <span class="nt">TRAP</span> <span class="nt">VECTOR</span> <span class="nt">AFTER</span>
<span class="o">;</span><span class="nt">TTY</span> <span class="nt">HAS</span> <span class="nt">INTERRUPTED</span>
<span class="nt">013702</span> <span class="nt">005037</span> <span class="nt">177564</span> <span class="nt">CLR</span> <span class="o">@</span><span class="p">#</span><span class="nn">TTCSR</span> <span class="o">;</span><span class="nt">DISABLE</span> <span class="nt">INTERRUPT</span> <span class="nt">ENABLE</span>
<span class="nt">013706</span> <span class="nt">012737</span> <span class="nt">000015</span> <span class="nt">177566</span> <span class="nt">MOV</span> <span class="p">#</span><span class="nn">15</span><span class="o">,@</span><span class="p">#</span><span class="nn">177566</span>
<span class="nt">013714</span> <span class="nt">000006</span> <span class="nt">RTT</span> <span class="o">;</span><span class="nt">RETURN</span> <span class="nt">TO</span> <span class="nt">INST</span> <span class="nt">FOLLOWING</span> <span class="nt">WAIT</span> <span class="nt">WITH</span> <span class="s1">'T'</span>
<span class="o">;</span><span class="nt">BIT</span> <span class="nt">SET</span>
<span class="nt">013716</span> <span class="nt">000240</span> <span class="nt">TTY7D</span><span class="o">:</span> <span class="nt">NOP</span>
<span class="nt">013720</span> <span class="nt">012737</span> <span class="nt">000016</span> <span class="nt">000014</span> <span class="nt">TTY7EX</span><span class="o">:</span> <span class="nt">MOV</span> <span class="p">#</span><span class="nn">BPTVEC</span><span class="o">+</span><span class="nt">2</span><span class="o">,@</span><span class="p">#</span><span class="nn">BPTVEC</span><span class="o">;</span><span class="nt">RESTORE</span> <span class="nt">VECTORS</span> <span class="nt">TO</span> <span class="nt">HALT</span> <span class="nt">AT</span>
<span class="nt">013726</span> <span class="nt">012737</span> <span class="nt">000066</span> <span class="nt">000064</span> <span class="nt">MOV</span> <span class="p">#</span><span class="nn">66</span><span class="o">,@</span><span class="p">#</span><span class="nn">TPVEC</span> <span class="o">;</span><span class="nt">VECTOR</span> <span class="o">+</span><span class="nt">2</span>
<span class="nt">013734</span> <span class="nt">005302</span> <span class="nt">DEC</span> <span class="o">%</span><span class="nt">2</span> <span class="o">;</span><span class="nt">CHECK</span> <span class="nt">INDICATOR</span>
<span class="nt">013736</span> <span class="nt">001401</span> <span class="nt">BEQ</span> <span class="o">.+</span><span class="nt">4</span>
<span class="nt">013740</span> <span class="nt">000000</span> <span class="nt">HLT</span> <span class="o">;</span><span class="nt">ERROR</span><span class="o">!</span> <span class="nt">DID</span> <span class="nt">NOT</span> <span class="nt">DO</span> <span class="nt">INC</span> <span class="nt">INST</span> <span class="nt">AFTER</span> <span class="nt">INTERRUPT</span>
</pre></div>
</td></tr></table>
<p>This test seems to be designed to return from an interrupt handler to a WAIT instruction, with the T bit set in
the PSW and a serial xmit interrupt pending. It verifies that the WAIT still "waits" in this circumstance. It also
verifies that a trace trap <em>does</em> occur after the immediately following INC instruction when the xmit interrupt
subsequently terminates the WAIT.</p>
<p>One potential problem with this test concerns the apparent assumption that enabling the xmit interrupt will cause an
immediate trap before the subsequent WAIT instruction. This is true if the serial transmitter is empty, but if the
transmitter is ever full/busy when this code is entered this assumption may not hold. Not sure yet if this will ever
be a problem for this test given the surrounding code.</p>
<p>In any case, as currently written this routine fails about 50% of the time on my 11/45. The failure mode
is that the processor sits at the WAIT instruction, (address display 013640, PC+2). Intervention with the
console halt switch (halt then back to enabl) breaks the WAIT microcode loop; console cont then takes us to the halt
at 013740 (address display 013742, PC+2).</p>
<p>The fact that the routine is tailing out through the halt at 013740 without hitting the halts at 013642 or 013644 is
interesting; this implies that the second serial xmit interrupt to TTY7C has executed. This is verified by examining
the break trap from the console after the test hangs up on the WAIT -- in the failure case, it is already reset to
point to TTY7D. So the failure mode seems to be that the return from the second xmit interrupt sometimes goes to the
WAIT instead of the subsequent INC.</p>
<p>Here is the microcode flow around the WAIT instruction. The horizontal line across the top is the A fork:</p>
<p><img src='/images/pdp11/wait-microcode.png'/></p>
<p>Using the KM11, in the failure case I can see the T bit set and the microcode looping through states WAT.00, WAT.20, WAT.30, WAT.11, which seems expected. I have also verified that executing a WAIT <em>without</em> the T bit set
loops through states WAT.00 and WAT.10.</p>
<p>Lastly, running on the RC maintenance clock at about half the usual clock frequency makes the failure case happen
almost 100% of the time.</p>
<p>Next I'll be needing to learn more about the BRQ logic, and in particular the mechanism by which the second xmit
interrupt nominally causes INTRF to be asserted. Understanding that should lead me to some things to check with the
logic probe and analyzer...</p></div>
<hr>
</div>
</div>
<div class="span3">
<div class="well" style="padding: 8px 0; background-color: #FBFBFB;">
<ul class="nav nav-list">
<li class="nav-header">
Site
</li>
<li><a href="https://fritzm.github.io/archives.html">Archives</a>
<li><a href="https://fritzm.github.io/tags.html">Tags</a>
<li><a href="https://fritzm.github.io/feeds/all.rss.xml" rel="alternate">RSS feed</a></li>
</ul>
</div>
<div class="well" style="padding: 8px 0; background-color: #FBFBFB;">
<ul class="nav nav-list">
<li class="nav-header">
Categories
</li>
<li><a href="https://fritzm.github.io/category/arcade-games.html">Arcade Games</a></li>
<li><a href="https://fritzm.github.io/category/math.html">Math</a></li>
<li><a href="https://fritzm.github.io/category/micros.html">Micros</a></li>
<li><a href="https://fritzm.github.io/category/pdp-11.html">PDP-11</a></li>
<li><a href="https://fritzm.github.io/category/programming.html">Programming</a></li>
<li><a href="https://fritzm.github.io/category/radios.html">Radios</a></li>
</ul>
</div>
<div class="social">
<div class="well" style="padding: 8px 0; background-color: #FBFBFB;">
<ul class="nav nav-list">
<li class="nav-header">
Social
</li>
<li><a href="http://facebook.com/fritzmueller">facebook</a></li>
<li><a href="http://instagram.com/infrafritz">Instagram</a></li>
<li><a href="http://www.linkedin.com/pub/fritz-mueller/a/679/62/">LinkedIn</a></li>
<li><a href="http://jsfiddle.net/user/fritzm/fiddles/">JSFiddle</a></li>
<li><a href="https://github.com/fritzm">GitHub</a></li>
</ul>
</div>
</div>
</div>
</div> </div>
<footer>
<br />
<p><a href="https://fritzm.github.io">fritzm.github.io</a> © Fritz Mueller 2023</p>
</footer>
</div> <!-- /container -->
<!-- Photoswipe -->
<div class="pswp" tabindex="-1" role="dialog" aria-hidden="true">
<div class="pswp__bg"></div>
<div class="pswp__scroll-wrap">
<div class="pswp__container">
<div class="pswp__item"></div>
<div class="pswp__item"></div>
<div class="pswp__item"></div>
</div>
<div class="pswp__ui pswp__ui--hidden">
<div class="pswp__top-bar">
<div class="pswp__counter"></div>
<button class="pswp__button pswp__button--close" title="Close (Esc)"></button>
<button class="pswp__button pswp__button--share" title="Share"></button>
<button class="pswp__button pswp__button--fs" title="Toggle fullscreen"></button>
<button class="pswp__button pswp__button--zoom" title="Zoom in/out"></button>
<div class="pswp__preloader">
<div class="pswp__preloader__icn">
<div class="pswp__preloader__cut">
<div class="pswp__preloader__donut"></div>
</div>
</div>
</div>
</div>
<div class="pswp__share-modal pswp__share-modal--hidden pswp__single-tap">
<div class="pswp__share-tooltip"></div>
</div>
<button class="pswp__button pswp__button--arrow--left" title="Previous (arrow left)">
</button>
<button class="pswp__button pswp__button--arrow--right" title="Next (arrow right)">
</button>
<div class="pswp__caption">
<div class="pswp__caption__center"></div>
</div>
</div>
</div>
</div>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script src="https://fritzm.github.io/theme/bootstrap-collapse.js"></script>
</body>
</html>