version 0.5.2
[fw/sdcc] / sim / ucsim / doc / cmd_general.html
1 <html>
2 <head>
3 <title>General commands of &micro;Csim</title>
4 </head>
5
6 <body bgcolor="white">
7
8 <h2>General commands of &micro;Csim</h2>
9
10
11 <a name="conf"><h3>conf</h3></a>
12
13 Conf command can be used to display different kind of information
14 about &micro;Csim. It can be followed by a subcommand:
15
16 <p><a href="#conf_">conf</a>
17 <br>conf <a href="#conf_objects">objects</a>
18
19 <blockquote>
20
21 <a name="conf_"><h4>conf</h4></a>
22
23 This command (without a subcommand) prints out configuration of the
24 simulator:
25
26 <pre>
27 0> <font color="#118811">conf</font>
28 ucsim version 0.5.0-pre3
29 Type of microcontroller: 51 CMOS
30 Controller has 9 hardware element(s).
31   timer0[0]
32   timer1[1]
33   uart[0]
34   port[0]
35   port[1]
36   port[2]
37   port[3]
38   irq[0]
39   _51_dummy[0]
40 0>
41 </pre>
42
43 First line contains version number of the program. Second line informs
44 about type of the simulated microcontroller. Third line prints out how
45 many hardware elements are simulated.
46
47 <a name="conf_objects"><h4>conf <i>objects</i></h4></a>
48
49 This command is for development only.
50
51 </blockquote>
52
53 <hr>
54
55
56 <a name="h"><h3>?,help <i>[command]</i></h3></a>
57
58 Help command. It prints out short description of the commands.
59
60 <p>If a command name is given as parameter then &micro;Csim prints out all
61 command that has similar names:
62
63 <pre>
64 0> <font color="#118811">? s</font>
65 show subcommand    Generic command for showing things about the uCsim
66 set subcommand     Set, see `set' command for more help
67 stop               Stop
68 step               Step
69 state              State of microcontroller
70 statistic [mem [startaddr [endaddr]]]
71                    Statistic of memory accesses
72 0> <font color="#118811">? s o</font>
73 show option [name] Show internal data of options
74 set option name|nr value
75                    Set value of an option
76 0> 
77 </pre>
78
79 Some commands have more than one name which can produce interesting
80 result:
81
82 <pre>
83 0> <font color="#118811">? t r</font>
84 timer delete id    Delete a timer
85 timer start id     Start a timer
86 0> 
87 </pre>
88
89 It looks that names of listed subcommands start with no "r" but take a
90 closer look on that commands:
91
92 <pre>
93 0> <font color="#118811">? t d</font>
94 timer delete id    Delete a timer
95 Names of command: delete remove
96 long help of timer delete
97 0> <font color="#118811">? t start</font>
98 timer start id     Start a timer
99 Names of command: run start
100 long help of timer run
101 0> </pre>
102
103 <p>If parameter is unique name of a command then long description of
104 the command is printed out.
105
106 <hr>
107
108
109 <a name="q"><h3>quit</h3></a>
110
111 Quit. This command terminates actual console, it does not ask you to
112 confirm your intention. Simulator always reads commands from a file so
113 end of file condition finishes too. If command console is on standard
114 input/output, pressing the CTRL-D will quit just like the quit
115 command.
116
117 <p>Note that if <a href="invoke.html#Zoption">-Z option</a> was used at
118 invokation then the quit command does not terminate the simulator
119 program. In this case <a href="#kill">kill</a> command can be used to
120 terminate the simulator. See for more information about <a
121 href="mulcons.html">using multiple consoles</a>.
122
123 <pre>$ <font color="#118811">s51</font>
124 ucsim 0.2.24, Copyright (C) 1997 Daniel Drotos, Talker Bt.
125 ucsim comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
126 This is free software, and you are welcome to redistribute it
127 under certain conditions; type `show c' for details.
128 > <font color="#118811">q</font>
129 $ </pre>
130
131 <hr>
132
133
134 <a name="kill"><h3>kill</h3></a>
135
136 This kommand terminates the simulator. It does not ask for
137 confirmation. It doesn't matter how many consoles are used and what
138 commands are running on them.
139
140 <hr>
141
142
143 <a name="exec"><h3>exec <i>file</i></h3></a>
144
145 Reads commands from "file" and executes them. This command opens a new
146 console (which will use same in/out file as the actual one) to execute
147 the file. This means the "quit" command in the file will not exit the
148 simulator:
149
150 <pre>
151 drdani@emma:~$ <font color="#118811">cat /tmp/x</font>
152 get opt
153 quit
154 conf
155 drdani@emma:~$ <font color="#118811">s51</font>
156 uCsim 0.5.0-pre3, Copyright (C) 1997 Daniel Drotos, Talker Bt.
157 uCsim comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
158 This is free software, and you are welcome to redistribute it
159 under certain conditions; type `show c' for details.
160 0> <font color="#118811">exec "/tmp/x"</font>
161 1> get opt
162  0. config_file(by application) is hidden!
163  1. console_on(by application) is hidden!
164  2. cpu_type(by application) is hidden!
165  3. debug(by console1): FALSE - Debug messages to console1
166  4. debug(by console0): FALSE - Debug messages to console0
167  5. debug(by application): FALSE - Print debug messages (-V)
168  6. irq_stop(by mcs51_controller): FALSE - Stop when IRQ accepted
169  7. null_prompt(by application): FALSE - Use \0 as prompt (-P)
170  8. prompt(by console1): "" - Prompt string of console1
171  9. prompt(by console0): "" - Prompt string of console0
172 10. prompt(by application): (null) - String of prompt (-p)
173 11. serial_in_file(by application) is hidden!
174 12. serial_out_file(by application) is hidden!
175 13. xtal(by application): 11059200.000 - Frequency of XTAL in Hz
176 1> quit
177 0> 
178 </pre>
179
180 <hr>
181
182
183 <a name="expression"><h3>expression <i>expr</i></h3></a>
184
185 Executes "expr" as an expression. For more about expressions, see <a
186 href="syntax.html">command syntax</a>.
187
188 <pre>
189 0> <font color="#118811">expr 1 + 2</font>
190 3
191 0> <font color="#118811">expr xram[256*dph+dpl]= &amp;sp</font>
192 129
193 0> 
194 </pre>
195
196
197 <hr>
198
199
200 <a name="show"><h3>show</h3></a>
201
202 Show command can be used to display different kind of information. It
203 must be followed by a subcommand. Subcommands are:
204
205 <p>show <a href="#show_copying">copying</a>
206 <br>show <a href="#show_warranty">warranty</a>
207 <br>show <a href="#show_option">option</a>
208 <br>show <a href="#show_error">error</a>
209
210 <blockquote>
211
212 <a name="show_copying"><h4>show copying</h4></a>
213
214 This command can be used to list licensing information. It is first 10
215 point of the version 2 of GNU Genral Public License. If you do not
216 accept GPL simply do not use the program.
217
218 <hr>
219
220 <a name="show_warranty"><h4>show warranty</h4></a>
221
222 This command prints out last 2 point of the license ("NO WARRANTY"
223 message).
224
225 <hr>
226
227 <a name="show_option"><h4>show option</h4></a>
228
229 This command is for development only.
230
231 <hr>
232
233 <a name="show_error"><h4>show error</h4></a>
234
235 Errors or warnings are events which can happen in the simulated system
236 during simulation. Report of that events can be turned on or off using
237 <a href="#set_error"><b>set error</b></a> command. Errors are
238 organized in parent-child relationship. Childs are listed under the
239 parent:
240
241 <pre>
242 0> <font color="#118811">sh er</font>
243 Error: non-classified [on/ON]
244   Error: memory [on/ON]
245     Error: invalid_address [unset/ON]
246     Error: non_decoded [unset/ON]
247   Error: stack [off/OFF]
248     Error: stack_tracker [unset/OFF]
249       Error: stack_tracker_wrong_handle [unset/OFF]
250       Error: operation_on_empty_stack [unset/OFF]
251       Warning: stack_operation_unmatched_to_top_of_stack [unset/OFF]
252       Warning: stack_looks_corrupted [unset/OFF]
253 0> </pre>
254
255 First element is the type (Error or Warning). Error stops the
256 simulation. Warning is just reported and simulation goes on. Next
257 element is the name of the error. Last element shows actual value and
258 state. Value can be:
259
260 <dl><dt><b>on</b></dt> <dd>state is ON
261
262 <dt><b>off</b><dt> <dd>state is OFF
263
264 <dt><b>unset</b></dt> <dd>state is inherited from the parent.
265 </dl>
266
267 If state is <b>ON</b> and the event happens, it is reported. If state
268 is <b>OFF</b> then the event is silently ignored.
269
270 </blockquote>
271 <hr>
272
273
274 <a name="get"><h3>get</h3></a>
275
276 This command can be used to get value of various kind of things. It
277 requires a subcommand to specify what is going to be set. Known
278 subcommands are:
279
280 <p>get <a href="#get_sfr">sfr</a>
281 <br>get <a href="#get_option">option</a>
282
283
284 <blockquote>
285
286 <a name="get_sfr"><h4>get sfr <i>address...</i></h4></a>
287
288 This command can be used to check values of SFR location(s) if SFR
289 exists in simulated memory. Note that <a
290 href="cmd_dump.html#dump_memory">dump memory</a> or <a
291 href="cmd_dump.html#ds">ds</a> can be used as well.
292
293 <p>Parameters are interpreted as SFR names or addresses and values of
294 addressed locations are dumped out.
295
296 <pre>
297 $ <font color="#118811">s51 </font>
298 ucsim 0.5.0-pre3, Copyright (C) 1997 Daniel Drotos, Talker Bt.
299 ucsim comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
300 This is free software, and you are welcome to redistribute it
301 under certain conditions; type `show c' for details.
302 0> <font color="#118811">get sfr pcon p1 0 0x80 kahd scon 256</font>
303 0x87 00 .
304 0x90 ff .
305 Warning: Invalid address 0
306 0x80 ff .
307 Warning: Invalid address kahd
308 0x98 00 .
309 Warning: Invalid address 256
310 0> </pre>
311
312 <hr>
313
314
315 <a name="get_option"><h4>get option <i>[name]</i></h4></a>
316
317 Get actual value of option(s). Some options can be set by <a
318 href="#set_option"><b>set option</b></a> to modify behavior of the
319 simulator. Using <b>get option</b> you can get actual value of these
320 options. If you use this command without parameter you get list of all
321 options known by the program. In this way you can figure out which
322 options can be used.
323
324 <pre>
325 $ <font color="#118811">s51 -V</font>
326 ucsim 0.5.0, Copyright (C) 1997 Daniel Drotos, Talker Bt.
327 ucsim comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
328 This is free software, and you are welcome to redistribute it
329 under certain conditions; type `show c' for details.
330 0> <font color="#118811">get opt</font>
331  3. debug(by console0): FALSE - Debug messages to console0
332  4. debug(by application): FALSE - Print debug messages (-V)
333  5. irq_stop(by mcs51_controller): FALSE - Stop when IRQ accepted
334  6. null_prompt(by application): FALSE - Use \0 as prompt (-P)
335  7. prompt(by console0): "" - Prompt string of console0
336  8. prompt(by application): (null) - String of prompt (-p)
337 11. xtal(by application): 11059200.000 - Frequency of XTAL in Hz
338 0> 
339 </pre>
340
341 First element of the list is the number of the option. It is followed
342 by name of the option (<b>debug</b>, <b>irq_stop</b>, etc.). Number or
343 the name can be used to identify the option in
344 <b>get option</b> and <a href="#set_option"><b>set option</b></a>
345 command. Next element shows which part of the simulator created the
346 option.
347
348 <p>Next element of the list is the value of the option. It can be an
349 integer or a floating point number, a string or a boolean value.
350
351 <p>Last part describes the option.
352
353 <p>Some options can have same name. An example is the <b>debug</b>
354 option. One is created by the application to store value given by -V
355 (see <a href="invoke.html">invokation</a>). This will be used as
356 default value when a new instance of a console is created:
357
358 <pre>
359 $ <font color="#118811">cat /tmp/x</font>
360 get opt debug
361 $ <font color="#118811">s51</font>
362 uCsim 0.5.0-pre3, Copyright (C) 1997 Daniel Drotos, Talker Bt.
363 uCsim comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
364 This is free software, and you are welcome to redistribute it
365 under certain conditions; type `show c' for details.
366 0> <font color="#118811">get opt debug</font>
367  3. debug(by console0): FALSE - Debug messages to console0
368  4. debug(by application): FALSE - Print debug messages (-V)
369 0> <font color="#118811">set opt 4 1</font>
370 0> <font color="#118811">get opt debug</font>
371  3. debug(by console0): FALSE - Debug messages to console0
372  4. debug(by application): TRUE - Print debug messages (-V)
373 0> <font color="#118811">exec "/tmp/x"</font>
374 1> get opt debug
375  3. debug(by console1): TRUE - Debug messages to console1
376  4. debug(by console0): FALSE - Debug messages to console0
377  5. debug(by application): TRUE - Print debug messages (-V)
378 1> 
379 0> 
380 </pre>
381
382 </blockquote>
383
384 <hr>
385
386
387 <a name="set"><h3>set</h3></a>
388
389 This command can be used to set various kind of things. It requires a
390 subcommand to specify what is going to be set. Known subcommands are:
391
392 <p>set <a href="#set_option">option</a>
393 <br>set <a href="#set_error">error</a>
394 <br>set <a href="#set_memory">memory</a>
395 <br>set <a href="#set_bit">bit</a>
396 <br>set <a href="#set_hardware">hardware</a>
397
398
399 <blockquote>
400
401 <a name="set_option"><h4>set option <i>name|nr value</i></h4></a>
402
403 <p>Set option value. Options described at (<a
404 href="#get_option"><b>get option</b></a>) command can be set using
405 this command. First parameter must be an option name or number and
406 second the new value. Interpretation of the value depends on type of
407 the option. Value for a boolean type of option interpreted as follows:
408 if first character of the value is one of <tt>1</tt>, <tt>t</tt>,
409 <tt>T</tt>, <tt>y</tt>, <tt>Y</tt> then value will be TRUE otherwise
410 it will be FALSE.
411
412 <pre>
413 $ <font color="#118811">s51 -V</font>
414 uCsim 0.5.0-pre3, Copyright (C) 1997 Daniel Drotos, Talker Bt.
415 uCsim comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
416 This is free software, and you are welcome to redistribute it
417 under certain conditions; type `show c' for details.
418 > <font color="#118811">get opt</font>
419  0. config_file(by application) is hidden!
420  1. console_on(by application) is hidden!
421  2. cpu_type(by application) is hidden!
422  3. debug(by console0): TRUE - Debug messages to console0
423  4. debug(by application): TRUE - Print debug messages (-V)
424  5. irq_stop(by mcs51_controller): FALSE - Stop when IRQ accepted
425  6. null_prompt(by application): FALSE - Use \0 as prompt (-P)
426  7. prompt(by console0): "" - Prompt string of console0
427  8. prompt(by application): (null) - String of prompt (-p)
428  9. serial_in_file(by application) is hidden!
429 10. serial_out_file(by application) is hidden!
430 11. xtal(by application): 11059200.000 - Frequency of XTAL in Hz
431 > <font color="#118811">set opt debug f</font>
432 Ambiguous option name, use number instead
433 > <font color="#118811">set opt 3 f</font>
434 > <font color="#118811">get opt debug</font>
435  3. debug(by console0): FALSE - Debug messages to console0
436  4. debug(by application): TRUE - Print debug messages (-V)
437 > </pre>
438
439 <hr>
440
441
442 <a name="set_error"><h4>set error <i>error_name
443 on|off|unset</i></h4></a>
444
445 This command can be used to set if an error event should be reported
446 or not. Actual settings can be retrieved by <a href="show_error">show
447 error</a> command.
448
449 <hr>
450
451
452 <a name="set_memory"><h4>set memory <i>memory_type address
453 data...</i></h4></a>
454
455 This command can be used to modify content of any simulated
456 memory. First parameter must be a class name to specify type of
457 memory. Class names can de checked by <a
458 href="cmd_general.html#info_memory">info memory</a> command. Chips and
459 address spaces can be used as well.
460
461 <p>Second parameter specifies start address of the modification.
462
463 <p>Remaining parameters will be written into the memory starting at
464 address specified by second parameter. Data list can include numbers
465 as well as strings. See <a href="syntax.html">syntax</a> for more
466 details.
467
468 <p>Modified memory locations will be dumped out.
469
470 <pre>
471 0> <font color="#118811">set mem xram 1 "ab\tcd\0ef\012ghq" 2 "ABC"</font>
472 0x0001 61 62 09 63 64 00 65 66 ab.cd.ef
473 0x0009 0a 67 68 71 02 41 42 43 .ghq.ABC
474 0> <font color="#118811">set mem sfr pcon 0x34</font>
475 0x87 34                      4
476 0> <font color="#118811">set mem xram_chip 1 2</font>
477 0x0001 02                      .
478 0> </pre>
479
480 <hr>
481
482
483 <a name="set_bit"><h4>set bit <i>address 0|1</i></h4></a>
484
485 Set one bit to 0 or 1. First parameter specifies the bit. It can be
486 the address of the bit (number or syqmbolic name) or it can be
487 specified in <i>address<b>.</b>bitnumber</i> format where
488 <i>address</i> addresses SFR area and <i>bitnumber</i> is number of
489 bit in specified SFR location. Using this syntax any SFR (and 8051's
490 internal RAM) location can be modified it need not be really bit
491 addressable.
492
493 <p>Second parameter interpreted as 1 if it is not zero.
494
495 <p>Modified memory location is dumped out.
496
497 <pre>
498 $ <font color="#118811">s51 </font>
499 ucsim 0.2.38-pre2, Copyright (C) 1997 Daniel Drotos, Talker Bt.
500 ucsim comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
501 This is free software, and you are welcome to redistribute it
502 under certain conditions; type `show c' for details.
503 > <font color="#118811">set bit tf1 1</font>
504 0x88 80 .
505 > <font color="#118811">set bit 130 0</font>
506 0x80 fb .
507 > <font color="#118811">set bit pcon.2 1</font>
508 0x87 04 .
509 > <font color="#118811">set bit 10.7 1</font>
510 0x0a 80 .
511
512 </pre>
513
514 <hr>
515
516
517 <a name="set_hardware"><h4>set hardware <i>hardware_id data</i></h4></a>
518
519 This command can be used to set value into a hardware element of the
520 controller (<a href="#conf">conf</a> command lists them).
521
522 <p>Actually only <b>port</b> element of MCS51 accepts this method. It
523 can be used to set value of external circuits which
524 connected to ports of simulated controller. First parameter specifies
525 port element (as an array), second is the new value.
526
527 <pre>
528 0> <font color="#118811">conf</font>
529 Type of microcontroller: 51 CMOS
530 Controller has 9 hardware element(s).
531   timer0[0]
532   timer1[1]
533   uart[0]
534   port[0]
535   port[1]
536   port[2]
537   port[3]
538   irq[0]
539   _51_dummy[0]
540 0> <font color="#118811">set hw port[0] 12</font>
541 0> <font color="#118811">i h po[0]</font>
542 port[0]
543 P0    11111111 0xff 255 . (Value in SFR register)
544 Pin0  00001100 0x0c  12 . (Output of outside circuits)
545 Port0 00001100 0x0c  12 . (Value on the port pins)
546 0> <font color="#118811">set hw port[0] 23</font>
547 0> <font color="#118811">i h po[0]</font>
548 port[0]
549 P0    11111111 0xff 255 . (Value in SFR register)
550 Pin0  00010111 0x17  23 . (Output of outside circuits)
551 Port0 00010111 0x17  23 . (Value on the port pins)
552 0> <font color="#118811">set hw irq[0] 12</font>
553 Nothing to do
554 0> 
555 </pre>
556
557 </blockquote>
558
559 <hr>
560
561
562 <a name="state"><h3>state</h3></a>
563
564 State of the simulator and the simulated microcontroller:
565
566 <pre>
567 > <font color="#118811">state</font>
568 CPU state= OK PC= 0x004349 XTAL= 1.10592e+07
569 Total time since last reset= 0.614873 sec (6800004 clks)
570 Time in isr = 0.0144227 sec (159504 clks) 2.3%
571 Time in idle= 0 sec (0 clks)   0%
572 Max value of stack pointer= 0x000049, avg= 0x000026
573
574 </pre>
575
576 The "CPU state" in the first line is an internal information. PC is
577 value of the program counter. First line shows XTAL frequency too.
578
579 <p>Following lines contain information about simulated time. First,
580 full simulated time (elapsed from last reset) is printed out in
581 seconds and number of clock periods then same data is printed out
582 about time spent in interrupt service routines as well as in idle
583 mode. Last data in lines of ISR and IDLE time shows ratio of ISRs,
584 Idle times and main program.
585
586 <p>Last line infroms about maximum value of the stack pointer and a
587 "not very well" calculated average value of it.
588
589 <hr>
590
591
592 <a name="reset"><h3>reset</h3></a>
593
594 Reset command. It resets the microcontroller. It has same effect as
595 active signal on the RST pin.
596
597 <pre>
598 $ <font color="#118811">s51 -V remoansi.hex</font>
599 ucsim 0.2.24, Copyright (C) 1997 Daniel Drotos, Talker Bt.
600 ucsim comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
601 This is free software, and you are welcome to redistribute it
602 under certain conditions; type `show c' for details.
603 58659 bytes read from remoansi.hex
604 > <font color="#118811">i r</font>
605 000000 00 00 00 00 00 00 00 00 ........
606 000000 00 .  ACC= 0x00   0 .  B= 0x00   DPTR= 0x0000 @DPTR= 0x00   0 .
607 000000 00 .  PSW= 0x00 CY=0 AC=0 OV=0 P=0
608    000000 02 01 60 LJMP  0160
609 > <font color="#118811">s</font>
610 000000 00 00 00 00 00 00 00 00 ........
611 000000 00 .  ACC= 0x00   0 .  B= 0x00   DPTR= 0x0000 @DPTR= 0x00   0 .
612 000000 00 .  PSW= 0x00 CY=0 AC=0 OV=0 P=0
613    000160 c2 90    CLR   P1.0
614 > <font color="#118811">s</font>
615 000000 00 00 00 00 00 00 00 00 ........
616 000000 00 .  ACC= 0x00   0 .  B= 0x00   DPTR= 0x0000 @DPTR= 0x00   0 .
617 000000 00 .  PSW= 0x00 CY=0 AC=0 OV=0 P=0
618    000162 c2 97    CLR   P1.7
619 > <font color="#118811">res</font>
620 > <font color="#118811">i r</font>
621 000000 00 00 00 00 00 00 00 00 ........
622 000000 00 .  ACC= 0x00   0 .  B= 0x00   DPTR= 0x0000 @DPTR= 0x00   0 .
623 000000 00 .  PSW= 0x00 CY=0 AC=0 OV=0 P=0
624    000000 02 01 60 LJMP  0160
625 > </pre>
626
627 <hr>
628
629
630 <a name="info"><h3>info</h3></a>
631
632 This command prints out information about different things which must
633 be specified as paramater to the command. Following subcommands are
634 known:
635
636 <p>info <a href="#info_breakpoints">breakpoints</a>
637 <br>info <a href="#info_registers">registers</a>
638 <br>info <a href="#info_hardware">hardware</a>
639 <br>info <a href="#info_stack">stack</a>
640 <br>info <a href="#info_memory">memory</a>
641
642 <blockquote>
643
644 <a name="info_breakpoints"><h4>info breakpoints</h4></a>
645
646 This subcommand prints out information about breakpoints:
647
648 <pre>
649 0> <font color="#118811">b 12</font>
650 Breakpoint 1 at 0x00000c: MOV   R7,A
651 0> <font color="#118811">tb 43</font>
652 Breakpoint 2 at 0x00002b: MOV   R7,A
653 0> <font color="#118811">b sfr w 0x80</font>
654 0> <font color="#118811">i b</font>
655 Num Type       Disp Hit   Cnt   Address  What
656 1   fetch      keep 1     1     0x00000c MOV   R7,A
657 2   fetch      del  1     1     0x00002b MOV   R7,A
658 3   event      keep 1     1     0x000080 write
659 0> 
660 </pre>
661
662 As you see above, the command can be shortened to "i b". The list of
663 breakpoints contains 7 columns:
664
665 <dl><dt><b>Num</b> <dd>Number of the breakpoint.
666
667 <dt><b>Type</b> <dd>This column shows type of the breakpoint. It can
668 be <i>fetch</i> for normal breakpoints or <i>event</i> for event
669 breakpoints. First the normal breakpoints are listed and then the
670 event breakpoints.
671
672 <dt><b>Disp</b> <dd>This shows if the breakpoint is temporary
673 (<i>del</i>) or not (<i>keep</i>).
674
675 <dt><b>Hit</b> <dd>How many times the breakpoint must be hit before it
676 really stops the program.
677
678 <dt><b>Cnt</b> <dd>Counter of breakpint hits. This counter decrements
679 and the breakpoint is activated if it reaches zero.
680
681 <dt><b>Address</b> <dd>Address where the breakpoint is set.
682
683 <dt><b>What</b> <dd>For normal breakpoints this field contains
684 disassembled instruction where the breakpoint is set. For event
685 breakpoints it contains type of event.
686
687 </dl>
688
689 <hr>
690
691
692 <a name="info_registers"><h4>info registers</h4></a>
693
694 This subcommand prints out full register set of the CPU. Output of
695 this command depends of type of CPU.
696
697 <h5>Registers of MCS51 family</h5>
698
699 <pre>
700 $ <font color="#118811">s51 remoansi.hex</font> 
701 ucsim 0.2.12, Copyright (C) 1997 Daniel Drotos, Talker Bt.
702 ucsim comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
703 This is free software, and you are welcome to redistribute it
704 under certain conditions; type `show c' for details.
705 58659 bytes read from remoansi.hex
706 > <font color="#118811">sopt stopit 1</font>
707 > <font color="#118811">g</font>
708 5
709  * 000023 02 01 1c LJMP  011c
710 > <font color="#118811">i r</font>
711 000000 18 02 16 ba 00 02 00 0a ........
712 000018 4a J  ACC= 0x0a  10 .  B= 0x00   DPTR= 0x16ba @DPTR= 0x00   0 .
713 000002 16 .  PSW= 0x00 CY=0 AC=0 OV=0 P=0
714  * 000023 02 01 1c LJMP  011c
715 > </pre>
716
717 In first line the actual register bank is dumped out. Register banks
718 reside in internal RAM, address at the begining of the line shows
719 start address of actual register bank selected by RS0 and RS1 bits of
720 PSW register.
721
722 <p>Next two lines begin with value of indirectly addressed internal
723 RAM cells. Second line shows IRAM cell pointed by R0 while third line
724 shows IRAM addressed by R1.
725
726 <p>Second line displays some important registers. First one is the
727 accumulator. Its value dumped out in hexadecimal, decimal form and
728 then the ASCII character of its value. It is followed by value of the
729 B register which is dumped out in hexadecimal form only. Next is DPTR
730 register in hexadecimal and then external RAM cell which is addressed
731 by DPTR. This is dumped out in hexadecimal, decimal and ASCII too.
732
733 <p>In third line you find program status word in hexadecimal and then
734 some flag bits of PSW register. Last line is disassembled instruction
735 at PC.
736
737 <h5>Registers of AVR family</h5>
738
739 <pre>
740 $ <font color="#118811">savr test_arith.hex</font>
741 ucsim 0.2.37, Copyright (C) 1997 Daniel Drotos, Talker Bt.
742 ucsim comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
743 This is free software, and you are welcome to redistribute it
744 under certain conditions; type `show c' for details.
745 > 83 words read from test_arith.hex
746 83 words read from test_arith.hex
747 > <font color="#118811">run</font>
748
749 Stop at 0x000047: (105) User stopped
750 F 0x000047
751 > <font color="#118811">i r</font>
752 000000 00 2c 21 23 20 35 19 14 03 00 00 00 00 00 00 00 .,!# 5..........
753 000010 00 01 1e 89 01 00 10 e2 14 00 01 10 00 00 00 00 ................
754 ITHSVNZC  SREG= 0x03   3 .
755 00000011  SP  = 0x000000
756 X= 0x1001 [X]= 0x00   0 .  Y= 0x0000 [Y]= 0x00   0 .  Z= 0x0000 [Z]= 0x00   0 .
757  * 000047 940c 0047 jmp   0x000047
758
759 </pre>
760
761 First two lines show first 32 bytes of internal RAM which is the
762 register set of AVR controllers.
763
764 <p>At the beginning of next two lines bits of status register are
765 printed. These lines present hexadecimal, decimal and ASCII values of
766 the status register too, and value of the stack pointer.
767
768 <p>Following line shows indirect addressing registers X, Y, and Z as
769 well as pointed memory values.
770
771 <p>Last line is disassembled instruction at PC.
772
773 <h5>Registers of Z80 family</h5>
774
775 <pre>
776 $ <font color="#118811">sz80</font>
777 uCsim 0.5.0-pre3, Copyright (C) 1997 Daniel Drotos, Talker Bt.
778 uCsim comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
779 This is free software, and you are welcome to redistribute it
780 under certain conditions; type `show c' for details.
781 0> <font color="#118811">i r</font>
782 SZ-A--P-C  Flags= 0x00   0 .  A= 0x00   0 .
783 00-0--0-0
784 BC= 0x0000 [BC]= 00   0 .  DE= 0x0000 [DE]= 00   0 .  HL= 0x0000 [HL]= 00   0 .
785 IX= 0x0000 [IX]= 00   0 .  IY= 0x0000 [IY]= 00   0 .  SP= 0x0000 [SP]= 00   0 .
786  ? 0x0000 00          NOP
787 0> 
788 </pre>
789
790 <h5>Registers of XA family</h5>
791
792 <pre>
793 $ <font color="#118811">sxa</font>
794 uCsim 0.5.0-pre3, Copyright (C) 1997 Daniel Drotos, Talker Bt.
795 uCsim comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
796 This is free software, and you are welcome to redistribute it
797 under certain conditions; type `show c' for details.
798 The XA Simulator is in development, UNSTABLE, DEVELOPERS ONLY!
799 0> <font color="#118811">i r</font>
800 CA---VNZ | R0:0100 R1:0302 R2:0504 R3:0706
801 00---000 | R4:0908 R5:0b0a R6:0d0c SP:0100 ES:0000  DS:0000
802  ? 0x0302 02 03             ADD   R0l,[R3]
803 0> 
804 </pre>
805
806 <h5>Registers of HC08 family</h5>
807
808 <pre>
809 $ <font color="#118811">shc08</font>
810 uCsim 0.5.0-pre3, Copyright (C) 1997 Daniel Drotos, Talker Bt.
811 uCsim comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
812 This is free software, and you are welcome to redistribute it
813 under certain conditions; type `show c' for details.
814 0> <font color="#118811">i r</font>
815 V--HINZC  Flags= 0x60  96 `  A= 0x00   0 .
816 0--00000      H= 0x00   0 .  X= 0x00   0 .
817 SP= 0x00ff [SP+1]= 00   0 .
818  ? 0x0000 00 01 02    brset #0,*0x01,0x0005
819 0> 
820 </pre>
821
822 <hr>
823
824
825 <a name="info_hardware"><h4>info hardware|hw <i>identifier</i></h4></a>
826
827 This subcommand prints out information about a unit of the
828 controller. <b>identifier</b> specifies hardware element. One form of
829 it is a name. Names of hardware elements can be checked by <a
830 href="#conf">conf</a> command. This form is accepted only when name is
831 unique. If more than one element exists with the same name then name
832 must be followed by id number in squere brackets in same form as it is
833 listed by <a href="#conf">conf</a> command.
834
835 <p>Ouput format of this command depends on CPU family and type of the
836 CPU too because requested unit can be different in different type of
837 controller even in the same CPU family.
838
839 <pre>
840 $ <font color="#118811">s51 -t 51</font>
841 ucsim 0.5.0-pre3, Copyright (C) 1997 Daniel Drotos, Talker Bt.
842 ucsim comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
843 This is free software, and you are welcome to redistribute it
844 under certain conditions; type `show c' for details.
845 0> <font color="#118811">conf</font>
846 ucsim version 0.5.0-pre3
847 Type of microcontroller: 51 CMOS
848 Controller has 8 hardware element(s).
849   timer0[0]
850   timer1[1]
851   uart[0]
852   port[0]
853   port[1]
854   port[2]
855   port[3]
856   irq[0]
857   _51_dummy[0]
858 0> <font color="#118811">i h port[2]</font>
859 port[2]
860 P2    11111111 0xff 255 . (Value in SFR register)
861 Pin2  11111111 0xff 255 . (Output of outside circuits)
862 Port2 11111111 0xff 255 . (Value on the port pins)
863 0> <font color="#118811">i h t[0]</font>
864 timer0[0] 0x0000 13 bit timer OFF irq=0 dis prio=0
865 0> <font color="#118811">i h u</font>
866 uart[0] Shift, fixed clock MultiProc=none irq=dis prio=0
867 Receiver OFF RB8=0 irq=0
868 Transmitter TB8=0 irq=0
869 0> 
870 </pre>
871
872 Timer #2 differs a little bit from other timers of MCS51:
873
874 <pre>
875 $ <font color="#118811">s51 -t 52</font>
876 ucsim 0.5.0-pre3, Copyright (C) 1997 Daniel Drotos, Talker Bt.
877 ucsim comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
878 This is free software, and you are welcome to redistribute it
879 under certain conditions; type `show c' for details.
880 0> <font color="#118811">i h timer0</font>
881 timer0[0] 0x0000 13 bit timer OFF irq=0 dis prio=0
882 0> <font color="#118811">i h t[2]</font>
883 timer2[2] 0x0000 reload 0x0000 timer OFF irq=0 dis prio=0
884 0> 
885 </pre>
886
887 <hr>
888
889
890 <a name="info_stack"><h4>info stack</h4></a>
891
892 This command prints out information about data stored in the CPU's
893 stack and operations which put them there.
894
895 <pre>
896 $ <font color="#118811">s51 ~/remo.hex</font>
897 uCsim 0.5.0-pre3, Copyright (C) 1997 Daniel Drotos, Talker Bt.
898 uCsim comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
899 This is free software, and you are welcome to redistribute it
900 under certain conditions; type `show c' for details.
901 55470 words read from /home/staff/drdani/remo.hex
902 0> <font color="#118811">set opt irq_stop true</font>
903 0> <font color="#118811">r</font>
904 Simulation started, PC=0x000000
905 Stop at 0x000023: (2) Interrupt
906 F 0x000023
907 0> <font color="#118811">i s</font>
908 OP   SP before-after   L DATA/ADDR   INSTRUCTION
909 call 0x000022-0x000024 2 0x002976    0x022a 12 29 76 LCALL 2976
910 call 0x000024-0x000026 2 0x002379    0x2976 12 23 79 LCALL 2379
911 call 0x000026-0x000028 2 0x003612    0x2517 12 36 12 LCALL 3612
912 intr 0x000028-0x00002a 2 0x000023    0x366f 20 0c 02 JB    21.4,3674
913 0> 
914 </pre>
915
916 First column shows the operation which can be <b>call</b> or
917 <b>push</b> or <b>intr</b> (interrupt call). Next column contains
918 value of the SP register before and after the operation. Column "L"
919 shows size of the data, and the next column the data itself. Note,
920 that for call operations (call, and intr) the <b>called</b> address is
921 printed, not the pushed one! Last column is the instruction which has
922 been executed when the operation occured.
923
924 <hr>
925
926
927 <a name="info_memory"><h4>info memory</h4></a>
928
929 This command shows information about <a href="memory.html">memory
930 system</a>: chips, address spaces and address decoders.
931
932 <pre>
933 $ <font color="#118811">s51</font>
934 uCsim 0.5.0-pre3, Copyright (C) 1997 Daniel Drotos, Talker Bt.
935 uCsim comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
936 This is free software, and you are welcome to redistribute it
937 under certain conditions; type `show c' for details.
938 0> <font color="#118811">i m</font>
939 Memory chips:
940   0x000000-0x010000    65536 rom_chip (8,%02x,0x%04x)
941   0x000000-0x000080      128 iram_chip (8,%02x,0x%02x)
942   0x000000-0x010000    65536 xram_chip (8,%02x,0x%04x)
943   0x000000-0x000080      128 sfr_chip (8,%02x,0x%02x)
944 Address spaces:
945   0x000000-0x010000    65536 rom (8,%02x,0x%04x)
946   0x000000-0x000080      128 iram (8,%02x,0x%02x)
947   0x000080-0x000080      128 sfr (8,%02x,0x%02x)
948   0x000000-0x010000    65536 xram (8,%02x,0x%04x)
949 Address decoders:
950  0 rom 0x0000 0xffff -> rom_chip 0x0000 activated
951  0 iram 0x00 0x7f -> iram_chip 0x00 activated
952  0 sfr 0x80 0xff -> sfr_chip 0x00 activated
953  0 xram 0x0000 0xffff -> xram_chip 0x0000 activated
954 0> 
955 </pre>
956
957 First column shows address ranges, next one is the size followed by
958 the name of the memory. This name can be used in other commands (such
959 as <a href="cmd_dump.html#dump">dump</a>, <a href="#set_memory">set
960 memory</a>, etc.). Last column shows some technical information
961 (width in bits, format specifier to print out content and address).
962
963 <p>Address decoders are associated with address spaces. Each address
964 space has a list of decoders. First column of the address decoder
965 information is the number of the decoder. Next three columns specifies
966 name and area of the address space which is handled by the
967 decoder. After "-&gt;" sign the name and the address of the memory
968 chip is printed where the decoder maps the area of the address space.
969
970 <p>Memory system of other controller family can be different.
971
972 <pre>
973 $ <font color="#118811">savr</font>
974 uCsim 0.5.0-pre3, Copyright (C) 1997 Daniel Drotos, Talker Bt.
975 uCsim comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
976 This is free software, and you are welcome to redistribute it
977 under certain conditions; type `show c' for details.
978 0> <font color="#118811">i m</font>
979 Memory chips:
980   0x000000-0x00ffff    65536 rom_chip (16,%04x,0x%04x)
981   0x000000-0x00007f      128 iram_chip (8,%02x,0x%02x)
982 Address spaces:
983   0x000000-0x00ffff    65536 rom (16,%04x,0x%04x)
984   0x000000-0x00ffff    65536 iram (8,%02x,0x%04x)
985 Address decoders:
986  0 rom 0x0000 0xffff -> rom_chip 0x0000 activated
987  0 iram 0x0000 0x007f -> iram_chip 0x00 activated
988 0> 
989 </pre>
990
991 </blockquote>
992
993 <hr>
994
995
996 <a name="timer"><h3>timer</i></h3></a>
997
998 Handling of timers. Don't be confused! This command doesn't handle
999 timer element of the controller. It manages "clock counters" which can
1000 be used to profile applications.
1001
1002 <p>Known subcommands are:
1003
1004 <p>timer <a href="#timer_add">add</a>
1005 <br>timer <a href="#timer_delete">delete</a>
1006 <br>timer <a href="#timer_get">get</a>
1007 <br>timer <a href="#timer_start">start</a>
1008 <br>timer <a href="#timer_stop">stop</a>
1009 <br>timer <a href="#timer_set">set</a>
1010
1011 <p>Each subcommand can (some must) be followed by a timer id which can be
1012 a number or a string. Timers are numbered from 1. You can use any
1013 number greater than 0 to identify a timer. Or you can use a simbolic
1014 name, in this case simulator uses the first unused number to allocate
1015 a new timer.
1016
1017 <blockquote>
1018
1019 <a name="timer_add"><h4>timer add|create|make <i>id [direction
1020 [in_isr]]</i></h4></a>
1021
1022 To create a new timer. New timers are turned ON by default and
1023 initialized to value 0. <b>Direction</b> is an integer (can be
1024 positive or negative) number which is added to the actual value in
1025 every step. If <b>in_isr</b> is TRUE the timer counts only when
1026 execution is in an interrupt handler.
1027
1028 <hr>
1029
1030
1031 <a name="timer_delete"><h4>timer delete|remove <i>id</i></h4></a>
1032
1033 To remove a timer if you don't need it any more.
1034
1035 <hr>
1036
1037
1038 <a name="timer_get"><h4>timer get <i>[id]</i></h4></a>
1039
1040 To get value of timers. If you don't use timer id in this command
1041 simulator prints out value of all timers including predefined
1042 ones. See example below.
1043
1044 <hr>
1045
1046
1047 <a name="timer_start"><h4>timer start|run <i>id</i></h4></a>
1048
1049 To turn a timer ON.
1050
1051 <hr>
1052
1053
1054 <a name="timer_stop"><h4>timer stop <i>id</i></h4></a>
1055
1056 To turn a timer OFF. It still exist but doesn't count xtal periods.
1057
1058 <hr>
1059
1060
1061 <a name="timer_set"><h4>timer set|value <i>id value</i></h4></a>
1062
1063 To set value of the timer (number of xtal periods). <b>value</b> is
1064 the new value.
1065
1066
1067 <pre>
1068 0> <font color="#118811">tim a 3</font>
1069 0> <font color="#118811">tim g</font>
1070 timer #0("time") ON: 0.463255 sec (5123232 clks)
1071 timer #0("isr") ON: 0.0051888 sec (57384 clks)
1072 timer #0("idle") ON,ISR: 0 sec (0 clks)
1073 timer #3("unnamed") ON: 0 sec (0 clks)
1074 0> <font color="#118811">tim a "a"</font>
1075 0> <font color="#118811">tim g</font>
1076 timer #0("time") ON: 0.463255 sec (5123232 clks)
1077 timer #0("isr") ON: 0.0051888 sec (57384 clks)
1078 timer #0("idle") ON,ISR: 0 sec (0 clks)
1079 timer #1("a") ON: 0 sec (0 clks)
1080 timer #3("unnamed") ON: 0 sec (0 clks)
1081 0> 
1082 </pre>
1083
1084 </blockquote>
1085
1086 <hr>
1087
1088
1089 </body>
1090 </html>