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
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
|
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-2">
<title>Execution commands of µCsim</title>
</head>
<body bgcolor="white">
<h2>Execution commands of <i>µCsim</i></h2>
<a name="run">
<h3>r,run,go [start [stop]]</h3>
</a>
This command starts the execution of the simulated program.
<p>Parameters are optional. First parameter specifies start address of the
execution. By default execution starts at address specified by actual
value of the PC. This can be overridden by the first parameter. </p>
<p>If second parameter is specified, it places a dynamic
breakpoint at specified address which stops the execution at
that address. If stop address is not given the simulator stops
if it reaches a breakpoint that was previously set, or the CPU
accepts an interrupt and <b>stopit</b> option is TRUE, or fatal error occurs or <a
href="#stop">stop</a> command is used on an other console, or ENTER key
is pressed on the console where the run command was issued. </p>
<p>When program execution is started, the console becomes <i>frozen</i>,
it is not possible to give commands on this console to the
simulator while the execution is running. If it is needed to
control the simulator during program execution then more
consoles can be used. See using <a href="mulcons.html">multiple
consoles</a> for more information. Meanwhile, simulation can be
stopped by pressing ENTER key on the frozen console (where the
run command was issused). </p>
<p>Note that first instruction is executed without effect of
breakpoints and simulation will be started afterwards. It means
that if there is a breakpoint at start address then it will not
be hit. See following example: </p>
<pre>$ <font color="#118811">./ucsim_51</font>
ucsim 0.2.38-pre1, Copyright (C) 1997 Daniel Drotos, Talker Bt.
ucsim comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
> <font color="#118811">b 0x10</font>
Breakpoint 1 at 0x000010: MOV R7,A
> <font color="#118811">b 0x20</font>
Breakpoint 2 at 0x000020: MOV R7,A
> <font color="#118811">run 0x10</font>
Warning: maybe not instruction at 0x000010
Simulation started, PC=0x000010
Stop at 0x000020: (104) Breakpoint
F 0x000020
>
</pre>
<hr>
<a name="emulation">
<h3>emulation</h3>
</a>
Starts simulation in so called "emulation" mode. In this mode
µCsim does not handle any user input, which means that all
consoles will be frozen and inputs for UARTs will be skipped.
<p>In emulation mode the simulation can not be stopped by any user
interaction. Breakpoints or the <a href="simif.html">simulator
interface</a> must be used to stop the simulation.
<hr>
<a name="stop">
<h3>stop</h3>
</a>
This command stops the simulation, it freezes the CPU and all the
peripherals.
<pre>$ <font color="#118811">ucsim_51 remoansi.hex</font>
ucsim 0.2.24, Copyright (C) 1997 Daniel Drotos, Talker Bt.
ucsim comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
58659 bytes read from remoansi.hex
> <font color="#118811">go</font>
Simulation started
> <font color="#118811">info reg</font>
000000 00 01 00 14 00 00 5a 47 ......ZG
000000 00 . ACC= 0x47 71 G B= 0x01 DPTR= 0x001c @DPTR= 0x47 71 G
000001 01 . PSW= 0x00 CY=0 AC=0 OV=0 P=0
006f02 90 00 1e MOV DPTR,#001e
> <font color="#118811">stop</font>
006ac5 24 a5 ADD A,#a5
>
</pre>
After using the stop command, the instruction pointed by PC is
disassembled, see the <a href="#dis"><b>dis</b></a> command for description
of disassembled form.
<hr>
<a name="step">
<h3>s,step [steps]</h3>
</a>
Step command. It executes one instruction without effect of
breakpoints.
<p>The optional parameter can be used to specify number of
instructions to execute. Note that breakpoints will stop the
execution after the first instruction. </p>
<pre>$ <font color="#118811">ucsim_51 remoansi.hex</font>
ucsim 0.2.12, Copyright (C) 1997 Daniel Drotos, Talker Bt.
ucsim comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
58659 bytes read from remoansi.hex
> <font color="#118811">s</font>
000000 00 00 00 00 00 00 00 00 ........
000000 00 . ACC= 0x00 0 . B= 0x00 DPTR= 0x0000 @DPTR= 0x00 0 .
000000 00 . PSW= 0x00 CY=0 AC=0 OV=0 P=0
000160 c2 90 CLR P1.0
> </pre>
<p> After execution of actual instruction pointed by PC (or all
instructions specified by the optional parameter) the <b>step</b> command
dumps out the register set.</p>
<p>Number of steps can be specified in different units. If no unit
is appended to step number then it will be interpreted as number
of instruction. Other know units are:</p>
<dl>
<dt>s, sec</dt>
<dd>Simulated execution time in seconds.</dd>
<dt>ms, msec</dt>
<dd>Simulated execution time in milliseconds.</dd>
<dt>us, usec</dt>
<dd>Simulated execution time in microseconds.</dd>
<dt>ns, nsec</dt>
<dd>Simulated execution time in nanoseconds.</dd>
<dt>vclk</dt>
<dd>Number of virtual clock counts.</dd>
<dt>fclk, fetch</dt>
<dd>Number of fetches.</dd>
<dt>rclk, read</dt>
<dd>Number of memory read operations.</dd>
<dt>wclk, write</dt>
<dd>Number of memory write operations.</dd>
</dl>
<br>
<hr>
<a name="n">
<h3>n,next</h3>
</a>
Execute until next instruction is reached. This command is similar
to <a
href="#s"><b>step</b></a> command described above but if actual
instruction to execute is a subroutine call the <b>next</b> command places
a dynamic breakpoint after the call instruction and starts to execute the
subroutine. If the subroutine is infinite the breakpoint set by <b>next</b>
will never be reached. It can be a dangerous situation because the
execution started by the <b>next</b> command can not be stopped
interactively. But it can be stopped by other breakpoints.
<pre>$ <font color="#118811">ucsim_51 remoansi.hex</font>
ucsim 0.2.12, Copyright (C) 1997 Daniel Drotos, Talker Bt.
ucsim comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
58659 bytes read from remoansi.hex
> <font color="#118811">run 0 0x172</font>
000172 79 04 MOV R1,#04
> <font color="#118811">dis 0x172 0 5</font>
000170 7f 00 MOV R7,#00
000172 79 04 MOV R1,#04
000174 12 0d b8 LCALL 0db8
000177 0f INC R7
000178 d9 fa DJNZ R1,0174
00017a 75 0b 00 MOV 0b,#00
> <font color="#118811">n</font>
000000 00 04 00 00 00 00 00 00 ........
000000 00 . ACC= 0x00 0 . B= 0x00 DPTR= 0x0000 @DPTR= 0x00 0 .
000004 00 . PSW= 0x00 CY=0 AC=0 OV=0 P=0
000174 12 0d b8 LCALL 0db8
> <font color="#118811">n</font>
000000 00 04 00 00 00 00 00 00 ........
000000 00 . ACC= 0x00 0 . B= 0x00 DPTR= 0x0167 @DPTR= 0x00 0 .
000004 00 . PSW= 0x00 CY=0 AC=0 OV=0 P=0
000177 0f INC R7
> </pre>
<hr> <a name="pc">
<h3>pc [address]</h3>
</a>
Using this command without any parameter it simply dumps out
instruction pointed by the PC. Specify address if you want to set
the PC.
<pre>$ ucsim_51
S51 0.1.5, Copyright (C) 1997 Daniel Drotos, Talker Bt.
S51 comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
> <font color="#118811">pc</font>
* 000000 ff MOV R7,A
> <font color="#118811">pc 123</font>
* 00007b ff MOV R7,A
> <font color="#118811">sopt debug t </font>
> <font color="#118811">pc 32</font>
Warning: maybe not instruction at 000020
* 000020 ff MOV R7,A
> </pre>
<hr>
<h3><a name="history">history</a></h3>
History command can be used to inspect and manipulate history of
executed instructions. It accepts following subcommands:
<p><a href="#history_">history</a> <br>
history <a href="#history_information">information</a> <br>
history <a href="#history_list">list</a> <br>
history <a href="#history_clear">clear</a> </p>
<blockquote>
<h4><a name="history_">history</a></h4>
This command (without a subcommand) prints out last 10 elements
of the command history in disassembled form.
<pre>0> <font color="#118811">hist</font>
? 0x0211 78 LD A,B
? 0x0212 de 22 SBC A,#0x22
? 0x0214 38 f7 JR C,#-9
? 0x0216 c9 RET
? 0x0109 c3 04 02 JP #0x0204
? 0x0204 3e 00 LD A,#0x00
? 0x0206 cf RST 8
? 0x0008 fb EI
? 0x0009 ed 4d RETI
? 0x0207 76 HALT
0>
</pre>
<hr>
<h4><a name="history_information">history information</a></h4>
Print out information about execution history.
<pre>0> <font color="#118811">hist info</font>
len: 100
used: 100
insts: 100
0>
</pre>
<b>Len</b> is size of the history, <b>used</b> shows how many slots are
filled, <b>insts</b> is number of the instructions recorded by
the history.
<hr>
<h4><a name="history_list">history list [nr]</a>
<br>
history print [nr]</h4>
This command is the same as the <a href="#history_">history</a> command
but it accepts a parameter which specifies how many records to print
(defaults to 10):
<pre>0> <font color="#118811">hist list 3</font>
? 0x0008 fb EI
? 0x0009 ed 4d RETI
? 0x0207 76 HALT
0> <font color="#118811">hist list 30</font>
? 0x020e 79 LD A,C
? 0x020f d6 33 sub #0x33
? 0x0211 78 LD A,B
? 0x0212 de 22 SBC A,#0x22
? 0x0214 38 f7 JR C,#-9
? 0x020d 03 INC BC
? 0x020e 79 LD A,C
? 0x020f d6 33 sub #0x33
? 0x0211 78 LD A,B
? 0x0212 de 22 SBC A,#0x22
? 0x0214 38 f7 JR C,#-9
? 0x020d 03 INC BC
? 0x020e 79 LD A,C
? 0x020f d6 33 sub #0x33
? 0x0211 78 LD A,B
? 0x0212 de 22 SBC A,#0x22
? 0x0214 38 f7 JR C,#-9
? 0x020d 03 INC BC
? 0x020e 79 LD A,C
? 0x020f d6 33 sub #0x33
? 0x0211 78 LD A,B
? 0x0212 de 22 SBC A,#0x22
? 0x0214 38 f7 JR C,#-9
? 0x0216 c9 RET
? 0x0109 c3 04 02 JP #0x0204
? 0x0204 3e 00 LD A,#0x00
? 0x0206 cf RST 8
? 0x0008 fb EI
? 0x0009 ed 4d RETI
? 0x0207 76 HALT
0>
</pre>
<hr>
<h4><a name="history_clear">history clear</a></h4>
This command clears the history, it deletes all recorded elements.
<pre>0> <font color="#118811">hist list 3</font>
? 0x0008 fb EI
? 0x0009 ed 4d RETI
? 0x0207 76 HALT
0> <font color="#118811">hist clear</font>
0> <font color="#118811">hist info</font>
len: 100
used: 0
insts: 0
0>
</pre>
</blockquote>
<!--OK-->
</body>
</html>
|