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
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
|
<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>General commands of µCsim</title>
</head>
<body style=" background-color: white;">
<h2>General commands of <i>µCsim</i></h2>
<h3><a name="analyse">analyse|analyze [<i>addr</i>]</a></h3>
<p>Runs the <a href="analyzer.html">analyser</a> to identify code.
If an address is given it is taken as the starting point and the results
added to any existing analysis. If no address is given or a file is loaded
into memory using the <a href="cmd_memory.html#file">file,load</a> command
any existing analysis is cleared and a new one created using all the known
hardware vectors as starting points.</p>
<h3><a name="conf">conf</a></h3>
Conf command can be used to display different kind of information
about <i>µCsim</i>. It can be followed by a subcommand:
<p><a href="#conf_">conf</a>
<br>conf <a href="#conf_objects">objects</a>
<br>conf <a href="#conf_types">types</a>
</p>
<blockquote>
<h4><a name="conf_">conf</a></h4>
This command (without a subcommand) prints out configuration of
the simulator:
<pre>0> <font color="#118811">conf</font>
ucsim version 0.5.0-pre3
Type of microcontroller: 51 CMOS
Controller has 9 hardware element(s).
timer0[0]
timer1[1]
uart[0]
port[0]
port[1]
port[2]
port[3]
irq[0]
_51_dummy[0]
0>
</pre> First line contains version number of the program. Second line informs
about type of the simulated microcontroller. Third line prints out how
many hardware elements are simulated.
<h4><a name="conf_types">conf <i>types</i></a></h4>
Print out all available CPU types
like <a href="invoke.html#H_option">-H option</a> of the
simulator.
<pre>0> <font color="#118811">conf types</font>
Parameter Family Subtype
C52 mcs52 cmos
51 mcs51 hmos
8051 mcs51 hmos
8751 mcs51 hmos
C51 mcs51 cmos
80C51 mcs51 cmos
87C51 mcs51 cmos
31 mcs51 hmos
8031 mcs51 hmos
C31 mcs51 cmos
80C31 mcs51 cmos
52 mcs52 hmos
8052 mcs51 hmos
8752 mcs51 hmos
80C52 mcs51 cmos
87C52 mcs51 cmos
32 mcs51 hmos
8032 mcs51 hmos
C32 mcs51 cmos
80C32 mcs51 cmos
F380 Silabs F380 cmos
51R Intel mcs51R cmos
51RA Intel mcs51R cmos
51RB Intel mcs51R cmos
51RC Intel mcs51R cmos
C51R Intel mcs51R cmos
C51RA Intel mcs51R cmos
C51RB Intel mcs51R cmos
C51RC Intel mcs51R cmos
89C51R 89C51R cmos
C521 AMD 80C521 cmos
521 AMD 80C521 cmos
251 Intel mcs251 cmos
C251 Intel mcs251 cmos
517 Siemens C517 cmos
C517 Siemens C517 cmos
88X Infineon XC88[68] cmos
886 Infineon XC88[68] cmos
888 Infineon XC88[68] cmos
XC88X Infineon XC88[68] cmos
XC886 Infineon XC88[68] cmos
XC888 Infineon XC88[68] cmos
DS320 Dallas DS80C320 cmos
DS390 Dallas DS80C390 cmos
DS390F Dallas DS80C390F cmos
0>
</pre>
<h4><a name="conf_objects">conf <i>objects</i></a></h4>
This command is for development only.
</blockquote>
<hr>
<h3><a name="version">version</a></h3>
Print out the version of the program.
<pre>0> <font color="#118811">ver</font>
0.6-pre58
0>
</pre>
<hr>
<h3><a name="h">?,help <i>[command]</i></a></h3>
Help command. It prints out short description of the commands.
<p>If a command name is given as parameter then <i>?Csim</i> prints out all
command that has similar names: </p>
<pre>0> <font color="#118811">? s</font>
show subcommand Generic command for showing things about the uCsim
set subcommand Set, see `set' command for more help
stop Stop
step Step
state State of microcontroller
statistic [mem [startaddr [endaddr]]]
Statistic of memory accesses
0> <font color="#118811">? s o</font>
show option [name] Show internal data of options
set option name|nr value
Set value of an option
0>
</pre> Some commands have more than one name which can produce interesting
result:
<pre>0> <font color="#118811">? t r</font>
timer delete id Delete a timer
timer start id Start a timer
0>
</pre> It looks that names of listed subcommands start with no "r" but take a
closer look on that commands:
<pre>0> <font color="#118811">? t d</font>
timer delete id Delete a timer
Names of command: delete remove
long help of timer delete
0> <font color="#118811">? t start</font>
timer start id Start a timer
Names of command: run start
long help of timer run
0> </pre>
<p>If parameter is unique name of a command then long description of the
command is printed out. </p>
<hr>
<h3><a name="q">quit</a></h3>
Quit. This command terminates actual console, it does not ask you to confirm
your intention. Simulator always reads commands from a file so end of file
condition finishes too.
<p>If networks server function is not turned of by <a href="invoke.html@zoption">-z option</a> and
some active connections are opened then quit will close the actual
console only and will not finish <i>µCsim</i>. Quit command
must be used on all consoles to completly exit, quit on last
console will exit the program.
<p>Note that if <a href="invoke.html#Zoption">-Z option</a> was used at
invocation then the quit command does not terminate the simulator program.
In this case <a href="#kill">kill</a> command can be used to terminate
the simulator. See for more information about <a href="mulcons.html">using
multiple consoles</a>. </p>
<pre>$ <font color="#118811">ucsim_51</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.
> <font color="#118811">q</font>
$ </pre>
<hr>
<h3><a name="kill">kill</a></h3>
This command terminates the simulator. It does not ask for confirmation. It
doesn't matter how many consoles are used and what commands are running on
them.
<hr>
<h3><a name="exec">exec <i>"file"</i></a></h3>
Reads commands from "file" and executes them. This command opens a new
console (which will use same in/out file as the actual one) to execute the
file. This means the "quit" command in the file will not exit the simulator:
<pre>drdani@emma:~$ <font color="#118811">cat /tmp/x</font>
get opt
quit
conf
drdani@emma:~$ <font color="#118811">ucsim_51</font>
uCsim 0.5.0-pre3, 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.
0> <font color="#118811">exec "/tmp/x"</font>
1> get opt
0. config_file(by application) is hidden!
1. console_on(by application) is hidden!
2. cpu_type(by application) is hidden!
3. debug(by console1): FALSE - Debug messages to console1
4. debug(by console0): FALSE - Debug messages to console0
5. debug(by application): FALSE - Print debug messages (-V)
6. irq_stop(by mcs51_controller): FALSE - Stop when IRQ accepted
7. null_prompt(by application): FALSE - Use \0 as prompt (-P)
8. prompt(by console1): "" - Prompt string of console1
9. prompt(by console0): "" - Prompt string of console0
10. prompt(by application): (null) - String of prompt (-p)
11. serial_in_file(by application) is hidden!
12. serial_out_file(by application) is hidden!
13. xtal(by application): 11059200.000 - Frequency of XTAL in Hz
1> quit
0>
</pre>
<hr>
<h3><a name="expression">expression [/format] <i>expr</i></a></h3>
Executes "expr" as an expression. For more about expressions, see <a href="syntax.html">command
syntax</a>.
<pre>0> <font color="#118811">expr 1+2</font>
3
0> <font color="#118811">expr xram[256*dph+dpl]= &sp</font>
129
0>
</pre>
Following formats are supported:
<ul>
<li><b>x</b> hexadecimal</li>
<li><b>X</b> hexadecimal prefixed with <tt>0x</tt></li>
<li><b>0</b> 8 character long hexadecimal prefixed with <tt>0x</tt></li>
<li><b>d</b> signed decimal</li>
<li><b>o</b> octal</li>
<li><b>u</b> unsigned decimal</li>
<li><b>b</b> binary</li>
<li><b>B</b> logical value as one bit</li>
<li><b>L</b> logical value in T/F form</li>
<li><b>c</b> chacter constant in 'c' form (non-printable values are
escaped in c syntax)</li>
</ul>
If more than one format character is used then all requested form will be
printed:
<pre>0> <font color="#118811">expr /bx 123</font>
00000000000000000000000001111011
7b
0> </pre>
<hr>
<h3><a name="echo">echo param...</a></h3>
Print all parameters separated by one space.
<hr>
<h3><a name="show">show</a></h3>
Show command can be used to display different kind of information. It must
be followed by a subcommand. Subcommands are:
<p>show <a href="#show_copying">copying</a> <br>
show <a href="#show_warranty">warranty</a> <br>
show <a href="#show_option">option</a> <br>
show <a href="#show_error">error</a> </p>
<blockquote>
<h4><a name="show_copying">show copying</a></h4>
This command can be used to list licensing information. It is first 10
point of the version 2 of GNU General Public License. If you do not accept
GPL simply do not use the program.
<hr>
<h4><a name="show_warranty">show warranty</a></h4>
This command prints out last 2 point of the license ("NO WARRANTY"
message).
<hr>
<h4><a name="show_option">show option</a></h4>
This command is for development only.
<hr>
<h4><a name="show_error">show error</a></h4>
Errors or warnings are events which can happen in the simulated system
during simulation. Report of that events can be turned on or off using <a
href="#set_error"><b>set error</b></a> command. Errors are organized in
parent-child relationship. Children are listed under the parent:
<pre>0> <font color="#118811">sh er</font>
Error: non-classified [on/ON]
Error: memory [on/ON]
Error: invalid_address [unset/ON]
Error: non_decoded [unset/ON]
Error: stack [off/OFF]
Error: stack_tracker [unset/OFF]
Error: stack_tracker_wrong_handle [unset/OFF]
Error: operation_on_empty_stack [unset/OFF]
Warning: stack_operation_unmatched_to_top_of_stack [unset/OFF]
Warning: stack_looks_corrupted [unset/OFF]
0> </pre>
First element is the type (Error or Warning). Error stops the simulation.
Warning is just reported and simulation goes on. Next element is the name
of the error. Last element shows actual value and state. Value can be:
<dl>
<dt><b>on</b></dt>
<dd>state is ON </dd>
<dt><b>off</b></dt>
<dd>state is OFF </dd>
<dt><b>unset</b></dt>
<dd>state is inherited from the parent. </dd>
</dl>
If state is <b>ON</b> and the event happens, it is reported. If state is
<b>OFF</b> then the event is silently ignored. </blockquote>
<hr>
<h3><a name="get">get</a></h3>
This command can be used to get value of various kind of things. It requires
a subcommand to specify what is going to be set. Known subcommands are:
<p>get <a href="#get_sfr">sfr</a> <br>
get <a href="#get_option">option</a> <br>
get <a href="#get_error">error</a> </p>
<blockquote>
<h4><a name="get_sfr">get sfr <i>address...</i></a></h4>
This command can be used to check values of SFR location(s) if SFR exists
in simulated memory. Note that <a href="cmd_dump.html#dump_memory">dump
memory</a> or <a href="cmd_dump.html#ds">ds</a> can be used as well.
<p>Parameters are interpreted as SFR names or addresses and values of
addressed locations are dumped out. </p>
<pre>$ <font color="#118811">ucsim_51 </font>
ucsim 0.5.0-pre3, 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.
0> <font color="#118811">get sfr pcon p1 0 0x80 kahd scon 256</font>
0x87 00 .
0x90 ff .
Warning: Invalid address 0
0x80 ff .
Warning: Invalid address kahd
0x98 00 .
Warning: Invalid address 256
0> </pre>
<hr>
<h4><a name="get_option">get option <i>[name]</i></a></h4>
Get actual value of option(s). Some options can be set by <a href="#set_option"><b>set
option</b></a> to modify behaviour of the simulator. Using <b>get
option</b> you can get actual value of these options. If you use this
command without parameter you get list of all options known by the
program. In this way you can figure out which options can be used.
<pre>$ <font color="#118811">ucsim_51 -V</font>
ucsim 0.5.0, 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.
0> <font color="#118811">get opt</font>
3. debug(by console0): FALSE - Debug messages to console0
4. debug(by application): FALSE - Print debug messages (-V)
5. irq_stop(by mcs51_controller): FALSE - Stop when IRQ accepted
6. null_prompt(by application): FALSE - Use \0 as prompt (-P)
7. prompt(by console0): "" - Prompt string of console0
8. prompt(by application): (null) - String of prompt (-p)
11. xtal(by application): 11059200.000 - Frequency of XTAL in Hz
0>
</pre> First element of the list is the number of the option. It is followed by
name of the option (<b>debug</b>, <b>irq_stop</b>, etc.). Number or the
name can be used to identify the option in <b>get option</b> and <a href="#set_option"><b>set
option</b></a> command. Next element shows which part of the simulator
created the option.
<p>Next element of the list is the value of the option. It can be an
integer or a floating point number, a string or a boolean value. </p>
<p>Last part describes the option. </p>
<p>Some options can have same name. An example is the <b>debug</b>
option. One is created by the application to store value given by -V
(see <a href="invoke.html">invocation</a>). This will be used as
default value when a new instance of a console is created: </p>
<pre>$ <font color="#118811">cat /tmp/x</font>
get opt debug
$ <font color="#118811">ucsim_51</font>
uCsim 0.5.0-pre3, 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.
0> <font color="#118811">get opt debug</font>
3. debug(by console0): FALSE - Debug messages to console0
4. debug(by application): FALSE - Print debug messages (-V)
0> <font color="#118811">set opt 4 1</font>
0> <font color="#118811">get opt debug</font>
3. debug(by console0): FALSE - Debug messages to console0
4. debug(by application): TRUE - Print debug messages (-V)
0> <font color="#118811">exec "/tmp/x"</font>
1> get opt debug
3. debug(by console1): TRUE - Debug messages to console1
4. debug(by console0): FALSE - Debug messages to console0
5. debug(by application): TRUE - Print debug messages (-V)
1>
0>
</pre>
<hr>
<h4><a name="get_error">get error</a></h4>
Same as <a href="#show_error">show error</a>. </blockquote>
<hr>
<h3><a name="set">set</a></h3>
This command can be used to set various kind of things. It requires a
subcommand to specify what is going to be set. Known subcommands are:
<p>set <a href="#set_option">option</a> <br>
set <a href="#set_error">error</a> <br>
set <a href="#set_memory">memory</a> <br>
set <a href="#set_bit">bit</a> <br>
set <a href="#set_hardware">hardware</a> </p>
<blockquote>
<h4><a name="set_option">set option <i>name|nr value</i></a></h4>
<p>Set option value. Options described at (<a href="#get_option"><b>get
option</b></a>) command can be set using this command. First
parameter must be an option name or number and second the new value.
Interpretation of the value depends on type of the option. Value for a
boolean type of option interpreted as follows: if first character of the
value is one of <tt>1</tt>, <tt>t</tt>, <tt>T</tt>, <tt>y</tt>, <tt>Y</tt>
then value will be TRUE otherwise it will be FALSE. </p>
<pre>$ <font color="#118811">ucsim_51 -V</font>
uCsim 0.5.0-pre3, 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">get opt</font>
0. config_file(by application) is hidden!
1. console_on(by application) is hidden!
2. cpu_type(by application) is hidden!
3. debug(by console0): TRUE - Debug messages to console0
4. debug(by application): TRUE - Print debug messages (-V)
5. irq_stop(by mcs51_controller): FALSE - Stop when IRQ accepted
6. null_prompt(by application): FALSE - Use \0 as prompt (-P)
7. prompt(by console0): "" - Prompt string of console0
8. prompt(by application): (null) - String of prompt (-p)
9. serial_in_file(by application) is hidden!
10. serial_out_file(by application) is hidden!
11. xtal(by application): 11059200.000 - Frequency of XTAL in Hz
> <font color="#118811">set opt debug f</font>
Ambiguous option name, use number instead
> <font color="#118811">set opt 3 f</font>
> <font color="#118811">get opt debug</font>
3. debug(by console0): FALSE - Debug messages to console0
4. debug(by application): TRUE - Print debug messages (-V)
> </pre>
<hr>
<h4><a name="set_error">set error <i>error_name on|off|unset</i></a></h4>
This command can be used to set if an error event should be reported or
not. Actual settings can be retrieved by <a href="show_error">show error</a>
command.<br>
<hr>
<h4><a name="set_console">set console <i>interactive
[on|off]|noninteractive|raw|edited</i>
</a></h4>
<hr>
<h4><a name="set_console_hw">set console <i>hw</i></a></h4>
<p>Open <a href="display.html">peripheral display</a> of <i>hw</i>.</p>
<hr>
<h4><a name="set_memory">set memory <i>memory_type address data...</i></a></h4>
This command can be used to modify content of any simulated memory. First
parameter must be a class name to specify type of memory. Class names can
be checked by <a href="cmd_general.html#info_memory">info memory</a>
command. Chips and address spaces can be used as well.
<p>Second parameter specifies start address of the modification. </p>
<p>Remaining parameters will be written into the memory starting at
address specified by second parameter. Data list can include numbers as
well as strings. See <a href="syntax.html">syntax</a> for more details.
</p>
<p>Modified memory locations will be dumped out. </p>
<pre>0> <font color="#118811">set mem xram 1 "ab\tcd\0ef\012ghq" 2 "ABC"</font>
0x0001 61 62 09 63 64 00 65 66 ab.cd.ef
0x0009 0a 67 68 71 02 41 42 43 .ghq.ABC
0> <font color="#118811">set mem sfr pcon 0x34</font>
0x87 34 4
0> <font color="#118811">set mem xram_chip 1 2</font>
0x0001 02 .
0> </pre>
<hr>
<h4><a name="set_bit">set bit <i>address 0|1</i></a></h4>
Set one bit to 0 or 1. First parameter specifies the bit. It can be the
address of the bit (number or symbolic name) or it can be specified in <i>address<b>.</b>bitnumber</i>
format where <i>address</i> addresses SFR area and <i>bitnumber</i> is
number of bit in specified SFR location. Using this syntax any SFR (and
8051's internal RAM) location can be modified it need not be really bit
addressable.
<p>Second parameter interpreted as 1 if it is not zero. </p>
<p>Modified memory location is dumped out. </p>
<pre>$ <font color="#118811">ucsim_51 </font>
ucsim 0.2.38-pre2, 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">set bit tf1 1</font>
0x88 80 .
> <font color="#118811">set bit 130 0</font>
0x80 fb .
> <font color="#118811">set bit pcon.2 1</font>
0x87 04 .
> <font color="#118811">set bit 10.7 1</font>
0x0a 80 .
>
</pre>
<hr>
<h4><a name="set_hardware">set hardware <i>hardware_id data</i></a></h4>
This command can be used to set value into a hardware element of the
controller (<a href="#conf">conf</a> command lists them).
<p>Actually only <b>port</b> element of MCS51 accepts this method. It can
be used to set value of external circuits which connected to ports of
simulated controller. First parameter specifies port element (as an
array), second is the new value. </p>
<pre>0> <font color="#118811">conf</font>
Type of microcontroller: 51 CMOS
Controller has 9 hardware element(s).
timer0[0]
timer1[1]
uart[0]
port[0]
port[1]
port[2]
port[3]
irq[0]
_51_dummy[0]
0> <font color="#118811">set hw port[0] 12</font>
0> <font color="#118811">i h po[0]</font>
port[0]
P0 11111111 0xff 255 . (Value in SFR register)
Pin0 00001100 0x0c 12 . (Output of outside circuits)
Port0 00001100 0x0c 12 . (Value on the port pins)
0> <font color="#118811">set hw port[0] 23</font>
0> <font color="#118811">i h po[0]</font>
port[0]
P0 11111111 0xff 255 . (Value in SFR register)
Pin0 00010111 0x17 23 . (Output of outside circuits)
Port0 00010111 0x17 23 . (Value on the port pins)
0> <font color="#118811">set hw irq[0] 12</font>
Nothing to do
0>
</pre> </blockquote>
<hr>
<h3><a name="state">state</a></h3>
State of the simulator and the simulated microcontroller:
<pre>> <font color="#118811">state</font>
CPU state= OK PC= 0x009c6c XTAL= 1.10592e+07
Operation since last reset= (51682412 vclks)
Inst= 51682412 Fetch= 51682412 Read= 0 Write= 0
Total time since last reset= 56.079 sec (620188944 clks)
Time in isr = 0 sec (0 clks) 0%
Time in idle= 0 sec (0 clks) 0%
Max value of stack pointer= 0x000007, avg= 0x000003
Simulation: stopped
>
</pre> The "CPU state" in the first line is an internal information. PC is value
of the program counter. First line shows XTAL frequency too.
<p>Following lines contain information about simulated time. First, full
simulated time (elapsed from last reset) is printed out in seconds and
number of clock periods then same data is printed out about time spent in
interrupt service routines as well as in idle mode. Last data in lines of
ISR and IDLE time shows ratio of ISRs, Idle times and main program. </p>
<p>Last lines inform about maximum value of the stack pointer and a "not
very well" calculated average value of it, and if the simulation is
running or stopped. </p>
<hr>
<h3><a name="reset">reset [hw]</a></h3>
Reset command. It resets the microcontroller. It has same effect as active
signal on the RST pin.
<pre>$ <font color="#118811">ucsim_51 -V 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">i r</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
000000 02 01 60 LJMP 0160
> <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
> <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
000162 c2 97 CLR P1.7
> <font color="#118811">res</font>
> <font color="#118811">i r</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
000000 02 01 60 LJMP 0160
> </pre>
Optional parameter can be the ID of a peripheral, a hardware
element. In this case the specified peripheral will be reseted only.
<pre>$ <font color="#118811">ucsim_p1516</font>
uCsim 0.8.9, Copyright (C) 1997 Daniel Drotos.
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.
0> <font color="#118811">conf</font>
ucsim version 0.8.9
Type of microcontroller: p2223-2.2.1
Controller has 17 hardware element(s).
on simif[0]
off vcd[0]
on dreg[0]
on pa[0]
on pb[0]
on pc[0]
on pd[0]
on pi[0]
on pj[0]
on uart[0]
on clock[0]
on dport[0]
on oports[0]
on iports[0]
on n4ddr[0]
on boolean[0]
on logsys[0]
0> <font color="#118811">reset uart</font>
0> </pre>
<hr>
<h3><a name="info">info</a></h3>
This command prints out information about different things which must be
specified as parameter to the command. Following subcommands are known:
<p>info <a href="#info_breakpoints">breakpoints</a> <br>
info <a href="#info_registers">registers</a> <br>
info <a href="#info_hardware">hardware</a> <br>
info <a href="#info_memory">memory</a> <br>
info <a href="#info_variables">variables</a> <br>
info <a href="#info_history">history</a> </p>
<blockquote>
<h4><a name="info_breakpoints">info breakpoints</a></h4>
This subcommand prints out information about breakpoints:
<pre>0> <font color="#118811">b 12</font>
Breakpoint 1 at 0x00000c: MOV R7,A
0> <font color="#118811">tb 43</font>
Breakpoint 2 at 0x00002b: MOV R7,A
0> <font color="#118811">b sfr w 0x80</font>
0> <font color="#118811">i b</font>
Num Type Disp Hit Cnt Address What
1 fetch keep 1 1 0x00000c MOV R7,A
2 fetch del 1 1 0x00002b MOV R7,A
3 event keep 1 1 0x000080 write
0>
</pre> As you see above, the command can be shortened to "i b". The list of
breakpoints contains 7 columns:
<dl>
<dt><b>Num</b> </dt>
<dd>Number of the breakpoint. </dd>
<dt><b>Type</b> </dt>
<dd>This column shows type of the breakpoint. It can be <i>fetch</i>
for normal breakpoints or <i>event</i> for event breakpoints. First
the normal breakpoints are listed and then the event breakpoints. </dd>
<dt><b>Disp</b> </dt>
<dd>This shows if the breakpoint is temporary (<i>del</i>) or not (<i>keep</i>).
</dd> <dt><b>Hit</b> </dt>
<dd>How many times the breakpoint must be hit before it really stops the
program. </dd>
<dt><b>Cnt</b> </dt>
<dd>Counter of breakpoint hits. This counter decrements and the
breakpoint is activated if it reaches zero. </dd>
<dt><b>Address</b> </dt>
<dd>Address where the breakpoint is set. </dd>
<dt><b>What</b> </dt>
<dd>For normal breakpoints this field contains disassembled instruction
where the breakpoint is set. For event breakpoints it contains type of
event. </dd>
</dl>
<hr>
<h4><a name="info_registers">info registers</a></h4>
This subcommand prints out full register set of the CPU. Output
of this command depends of type of CPU.
<h5>Registers of MCS51 family</h5>
<pre>
0> <font color="#118811">i r</font>
R0 R1 R2 R3 R4 R5 R6 R7
41 58 fc c9 8b bc 95 6b
@R0 76 v ACC= 0x00 0 . B= 0x00
@R1 73 s PSW= 0x00 CY=0 AC=0 OV=0 P=0
SP 0x07 -> 6b 95 bc 8b c9 fc 58 41
DPTR= 0x0000 @DPTR= 0x83 131 .
0x0000 ? ff MOV R7,A
0>
</pre>
In first two lines the actual register bank is dumped
out. Register banks reside in internal RAM, actual register bank
selected by RS0 and RS1 bits of PSW register.
<p>Next two lines begin with value of indirectly addressed
internal RAM cells and show most important internal registers,
A, B, PSW and flags.</p>
<p>Next line shows the stack pointer and top of the stack.</p>
<p>Last line shows the DPTR and XRAM value where it points.</p>
<p>After register values, instruction at PC is disassembled.</p>
<h5>Registers of AVR family</h5>
<pre>
> <font color="#118811">i r</font>
000000 00 2c 21 23 20 35 19 14 03 00 00 00 00 00 00 00 .,!# 5..........
000010 00 01 1e 89 01 00 10 e2 14 00 01 10 00 00 00 00 ................
ITHSVNZC SREG= 0x03 3 .
00000011 SP = 0x000000
X= 0x1001 [X]= 0x00 0 . Y= 0x0000 [Y]= 0x00 0 . Z= 0x0000 [Z]= 0x00 0 .
0x0000 ? 5a41 subi r0,161
>
</pre>
First two lines show first 32 bytes of internal RAM which is the register
set of AVR controllers.
<p>At the beginning of next two lines bits of status register are printed.
These lines present hexadecimal, decimal and ASCII values of the status
register too, and value of the stack pointer. </p>
<p>Following line shows indirect addressing registers X, Y, and Z as well
as pointed memory values. </p>
<p>Last line is disassembled instruction at PC. </p>
<h5>Registers of Z80 family</h5>
<pre>
0> <font color="#118811">i r</font>
SZ-A--P-C Flags= 0x00 0 . A= 0x00 0 .
00-0--0-0
BC= 0x0000 [BC]= 00 0 . DE= 0x0000 [DE]= 00 0 . HL= 0x0000 [HL]= 00 0 .
IX= 0x0000 [IX]= 00 0 . IY= 0x0000 [IY]= 00 0 . SP= 0x0000 [SP]= 00 0 .
SP limit= 0xf000
SP= 0xffff -> 0041 58fc c98b bc95 6b72 266b c55e af85 8cd8 65df a8d9 9fa6
0x0000 ? 41 LD B,C
0>
</pre>
<h5>Registers of XA family</h5>
<pre>
0> <font color="#118811">i r</font>
CA---VNZ | R0:0100 R1:0302 R2:0504 R3:0706
00---000 | R4:0908 R5:0b0a R6:0d0c SP:0100 ES:0000 DS:0000
0x0000 ? 41 58 CMP R2h,R4l
0>
</pre>
<h5>Registers of HC08 family</h5>
<pre>
0> <font color="#118811">i r</font>
V--HINZC Flags= 0x60 96 ` A= 0x00 0 .
0--00000 H= 0x00 0 . X= 0x00 0 .
SP= 0x00ff [SP+1]= 00 0 . Limit= $7000
0xf17c ? 19 ee bclr #4,*$ee
0>
</pre>
<hr>
<h4><a name="info_hardware">info hardware|hw <i>identifier</i></a></h4>
This subcommand prints out information about a unit of the controller. <b>identifier</b>
specifies hardware element. One form of it is a name. Names of hardware
elements can be checked by <a href="#conf">conf</a> command. This form is
accepted only when name is unique. If more than one element exists with
the same name then name must be followed by id number in square brackets
in same form as it is listed by <a href="#conf">conf</a> command.
<p>Output format of this command depends on CPU family and type of the CPU
too because requested unit can be different in different type of
controller even in the same CPU family. </p>
<pre>$ <font color="#118811">ucsim_51 -t 51</font>
ucsim 0.5.0-pre3, 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.
0> <font color="#118811">conf</font>
ucsim version 0.5.0-pre3
Type of microcontroller: 51 CMOS
Controller has 8 hardware element(s).
timer0[0]
timer1[1]
uart[0]
port[0]
port[1]
port[2]
port[3]
irq[0]
_51_dummy[0]
0> <font color="#118811">i h port[2]</font>
port[2]
P2 11111111 0xff 255 . (Value in SFR register)
Pin2 11111111 0xff 255 . (Output of outside circuits)
Port2 11111111 0xff 255 . (Value on the port pins)
0> <font color="#118811">i h t[0]</font>
timer0[0] 0x0000 13 bit timer OFF irq=0 dis prio=0
0> <font color="#118811">i h u</font>
uart[0] Shift, fixed clock MultiProc=none irq=dis prio=0
Receiver OFF RB8=0 irq=0
Transmitter TB8=0 irq=0
0>
</pre> Timer #2 differs a little bit from other timers of MCS51:
<pre>$ <font color="#118811">ucsim_51 -t 52</font>
ucsim 0.5.0-pre3, 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.
0> <font color="#118811">i h timer0</font>
timer0[0] 0x0000 13 bit timer OFF irq=0 dis prio=0
0> <font color="#118811">i h t[2]</font>
timer2[2] 0x0000 reload 0x0000 timer OFF irq=0 dis prio=0
0>
</pre>
<hr>
<!--
<h4><a name="info_stack">info stack</a></h4> This command prints out information about data stored in the CPU's stack and operations which put them there. <pre>$ <font color="#118811">ucsim_51 ~/remo.hex</font>uCsim 0.5.0-pre3, 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 itunder certain conditions; type `show c' for details.55470 words read from /home/staff/drdani/remo.hex0> <font color="#118811">set opt irq_stop true</font>0> <font color="#118811">r</font>Simulation started, PC=0x000000Stop at 0x000023: (2) InterruptF 0x0000230> <font color="#118811">i s</font>OP SP before-after L DATA/ADDR INSTRUCTION
call 0x000022-0x000024 2 0x002976 0x022a 12 29 76 LCALL 2976call 0x000024-0x000026 2 0x002379 0x2976 12 23 79 LCALL 2379call 0x000026-0x000028 2 0x003612 0x2517 12 36 12 LCALL 3612intr 0x000028-0x00002a 2 0x000023 0x366f 20 0c 02 JB 21.4,36740> </pre> First column shows the operation which can be <b>call</b> or <b>push</b> or <b>intr</b> (interrupt call). Next column contains value of the SP register before and after the operation. Column "L" shows size of the data, and the next column the data itself. Note, that for call operations (call, and intr) the <b>called</b> address is printed, not the pushed one! Last column is the instruction which has been executed when the operation occurred.<hr>-->
<h4><a name="info_memory">info memory</a></h4>
This command shows information about <a href="memory.html">memory system</a>:
chips, address spaces and address decoders.
<pre>$ <font color="#118811">ucsim_51</font>
uCsim 0.5.0-pre3, 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.
0> <font color="#118811">i m</font>
Memory chips:
0x000000-0x010000 65536 rom_chip (8,%02x,0x%04x)
0x000000-0x000080 128 iram_chip (8,%02x,0x%02x)
0x000000-0x010000 65536 xram_chip (8,%02x,0x%04x)
0x000000-0x000080 128 sfr_chip (8,%02x,0x%02x)
Address spaces:
0x000000-0x010000 65536 rom (8,%02x,0x%04x)
0x000000-0x000080 128 iram (8,%02x,0x%02x)
0x000080-0x000080 128 sfr (8,%02x,0x%02x)
0x000000-0x010000 65536 xram (8,%02x,0x%04x)
Address decoders:
0 rom 0x0000 0xffff -> rom_chip 0x0000 activated
0 iram 0x00 0x7f -> iram_chip 0x00 activated
0 sfr 0x80 0xff -> sfr_chip 0x00 activated
0 xram 0x0000 0xffff -> xram_chip 0x0000 activated
0>
</pre> First column shows address ranges, next one is the size followed by the
name of the memory. This name can be used in other commands (such as <a href="cmd_dump.html#dump">dump</a>,
<a href="#set_memory">set memory</a>, etc.). Last column shows some
technical information (width in bits, format specifier to print out
content and address).
<p>Address decoders are associated with address spaces. Each address space
has a list of decoders. First column of the address decoder information
is the number of the decoder. Next three columns specifies name and area
of the address space which is handled by the decoder. After "->" sign
the name and the address of the memory chip is printed where the decoder
maps the area of the address space. </p>
<p>Memory system of other controller family can be different. </p>
<pre>$ <font color="#118811">savr</font>
uCsim 0.5.0-pre3, 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.
0> <font color="#118811">i m</font>
Memory chips:
0x000000-0x00ffff 65536 rom_chip (16,%04x,0x%04x)
0x000000-0x00007f 128 iram_chip (8,%02x,0x%02x)
Address spaces:
0x000000-0x00ffff 65536 rom (16,%04x,0x%04x)
0x000000-0x00ffff 65536 iram (8,%02x,0x%04x)
Address decoders:
0 rom 0x0000 0xffff -> rom_chip 0x0000 activated
0 iram 0x0000 0x007f -> iram_chip 0x00 activated
0>
</pre>
<hr>
<h4><a name="info_variables">info variables [[/filter] search]</a></h4>
Print out information about variables. Variable is memory location which
has a name. It can be created by <a href="cmd_memory.html#var">var</a>
command and several variables are created by the simulator. Optionally the
search string can be specified in the command to search for it in variable
names.
<p>Optional /filter parameter can be used to select variables according
to place where they were defined:</p>
<ul><li>/p List predefined variables only,</li>
<li>/u Print user defined variables,</li>
<li>/d List variables from debug info (cdb) file</li>
</ul>
<pre>0> <font color="#118811">info var a</font>
pa rom[0xf000] = 00000000
Data register of pa
sim_real_time simif_0_cfg[0xa] = 00000000
Real time since reset in msec (int, RO)
sim_reason simif_0_cfg[0x5] = 00000000
Reason of last stop (int, RO)
sim_start simif_0_cfg[0x2] = 00000000
WR: start simulation, RD: true if running
sim_xtal simif_0_cfg[0x6] = 00a8c000
Xtal frequency in Hz (int, RW)
0> <font color="#118811">var abc</font>
0> <font color="#118811">i v a</font>
abc variables[0x00] = 00000000
pa rom[0xf000] = 00000000
Data register of pa
sim_real_time simif_0_cfg[0xa] = 00000000
Real time since reset in msec (int, RO)
sim_reason simif_0_cfg[0x5] = 00000000
Reason of last stop (int, RO)
sim_start simif_0_cfg[0x2] = 00000000
WR: start simulation, RD: true if running
sim_xtal simif_0_cfg[0x6] = 00a8c000
Xtal frequency in Hz (int, RW)
0>
</pre>
First word is the name of the variable, followed by memory and the
address, last word is the actual value in hexadecimal. Predefined
variables have a short description which is printed in next line.
<hr>
<h4><a name="info_history">info history</a></h4>
This command is the same as <a href="cmd_exec.html#history_information">history
information</a>. </blockquote>
<hr>
<h3><a name="timer">timer</a></h3>
Handling of timers. Don't be confused! This command doesn't handle timer
element of the controller. It manages "clock counters" which can be used to
profile applications.
<p>Known subcommands are: </p>
<p>timer <a href="#timer_add">add</a> <br>
timer <a href="#timer_delete">delete</a> <br>
timer <a href="#timer_get">get</a> <br>
timer <a href="#timer_start">start</a> <br>
timer <a href="#timer_stop">stop</a> <br>
timer <a href="#timer_set">set</a> </p>
<p>Each subcommand can (some must) be followed by a timer id which can be a
number or a string. Timers are numbered from 1. You can use any number
greater than 0 to identify a timer. Or you can use a symbolic name, in
this case simulator uses the first unused number to allocate a new timer.
</p>
<blockquote>
<h4><a name="timer_add">timer add|create|make <i>id [direction [in_isr]]</i></a></h4>
To create a new timer. New timers are turned ON by default and initialized
to value 0. <b>Direction</b> is an integer (can be positive or negative)
number which is added to the actual value in every step. If <b>in_isr</b>
is TRUE the timer counts only when execution is in an interrupt handler.
<hr>
<h4><a name="timer_delete">timer delete|remove <i>id</i></a></h4>
To remove a timer if you don't need it any more.
<hr>
<h4><a name="timer_get">timer get <i>[id]</i></a></h4>
To get value of timers. If you don't use timer id in this command
simulator prints out value of all timers including predefined ones. See
example below.
<hr>
<h4><a name="timer_start">timer start|run <i>id</i></a></h4>
To turn a timer ON.
<hr>
<h4><a name="timer_stop">timer stop <i>id</i></a></h4>
To turn a timer OFF. It still exist but doesn't count xtal periods.
<hr>
<h4><a name="timer_set">timer set|value <i>id value</i></a></h4>
To set value of the timer (number of xtal periods). <b>value</b> is the
new value.
<pre>0> <font color="#118811">tim a 3</font>
0> <font color="#118811">tim g</font>
timer #0("time") ON: 0.463255 sec (5123232 clks)
timer #0("isr") ON: 0.0051888 sec (57384 clks)
timer #0("idle") ON,ISR: 0 sec (0 clks)
timer #3("unnamed") ON: 0 sec (0 clks)
0> <font color="#118811">tim a "a"</font>
0> <font color="#118811">tim g</font>
timer #0("time") ON: 0.463255 sec (5123232 clks)
timer #0("isr") ON: 0.0051888 sec (57384 clks)
timer #0("idle") ON,ISR: 0 sec (0 clks)
timer #1("a") ON: 0 sec (0 clks)
timer #3("unnamed") ON: 0 sec (0 clks)
0>
</pre> </blockquote>
<hr>
</body>
</html>
|