Imported Upstream version 2.9.0
[debian/cc1111] / sim / ucsim / doc / cmd_exec.html
1 <html>
2 <head>
3 <title>Execution commands of &micro;Csim</title>
4 </head>
5
6 <body bgcolor="white">
7
8
9 <h2>Execution commands of &micro;Csim</h2>
10
11
12 <a name="run"><h3>r,run,go [start [stop]]</h3></a>
13
14 This command starts the execution of the simulated program.
15
16 <p>Parameters are optional. First parameter specifies start address of
17 the execution. By default execution starts at address specified by
18 actual value of the PC. This can be overridden by first parameter.
19
20 <p>If second parameter is specified it places a dynamic breakpoint at
21 specified address which stops the execution. If stop address is not
22 given the simulator stops if it reaches a breakpoint, or the CPU
23 accepts an interrupt and <b>stopit</b> option is TRUE, or fatal error
24 occures or <a href="#stop">stop</a> command is used on an other
25 console, or ENTER key is pressed on the console where the run command
26 was issued.
27
28 <p>If program execution is started the console is <i>frozen</i> it is
29 not possible to give commands on this console to the simulator while
30 execution is running. If it is needed to control the simulator during
31 program execution then more consoles can be used. See using <a
32 href="mulcons.html">multiple consoles</a> for more information.
33
34 <p>Note that first instruction is executed without effect of
35 breakpoints and simulation will be started afterwards. It means that
36 if there is a breakpoint at start address then it will not be hit. See
37 following example:
38
39 <pre>
40 $ <font color="#118811">./s51</font>
41 ucsim 0.2.38-pre1, Copyright (C) 1997 Daniel Drotos, Talker Bt.
42 ucsim comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
43 This is free software, and you are welcome to redistribute it
44 under certain conditions; type `show c' for details.
45 > <font color="#118811">b 0x10</font>
46 Breakpoint 1 at 0x000010: MOV   R7,A
47 > <font color="#118811">b 0x20</font>
48 Breakpoint 2 at 0x000020: MOV   R7,A
49 > <font color="#118811">run 0x10</font>
50 Warning: maybe not instruction at 0x000010
51 Simulation started, PC=0x000010
52 Stop at 0x000020: (104) Breakpoint
53 F 0x000020
54
55 </pre>
56
57 <hr>
58
59
60 <a name="stop"><h3>stop</h3></a>
61
62 This command stops the simulation, it freezes the CPU and all the
63 peripherials.
64
65 <pre>
66 $ <font color="#118811">s51 remoansi.hex</font>
67 ucsim 0.2.24, Copyright (C) 1997 Daniel Drotos, Talker Bt.
68 ucsim comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
69 This is free software, and you are welcome to redistribute it
70 under certain conditions; type `show c' for details.
71 58659 bytes read from remoansi.hex
72 > <font color="#118811">g</font>
73 Simulation started
74 > <font color="#118811">dr</font>
75 000000 00 01 00 14 00 00 5a 47 ......ZG
76 000000 00 .  ACC= 0x47  71 G  B= 0x01   DPTR= 0x001c @DPTR= 0x47  71 G
77 000001 01 .  PSW= 0x00 CY=0 AC=0 OV=0 P=0
78    006f02 90 00 1e MOV   DPTR,#001e
79 > <font color="#118811">stop</font>
80    006ac5 24 a5    ADD   A,#a5
81
82 </pre>
83
84 Simulated program is executed in background and the simulator accepts
85 commands. If it stopped by the stop command the instruction pointed by
86 PC is dissassembled, see the <a href="#dis"><b>dis</b></a> command for
87 description of disassembled form.
88
89 <hr>
90
91
92 <a name="step"><h3>s,step</h3></a>
93
94 Step command. It executes one instruction without effect of
95 breakpoints.
96
97 <pre>
98 $ <font color="#118811">s51 remoansi.hex</font>
99 ucsim 0.2.12, Copyright (C) 1997 Daniel Drotos, Talker Bt.
100 ucsim comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
101 This is free software, and you are welcome to redistribute it
102 under certain conditions; type `show c' for details.
103 58659 bytes read from remoansi.hex
104 > <font color="#118811">s</font>
105 000000 00 00 00 00 00 00 00 00 ........
106 000000 00 .  ACC= 0x00   0 .  B= 0x00   DPTR= 0x0000 @DPTR= 0x00   0 .
107 000000 00 .  PSW= 0x00 CY=0 AC=0 OV=0 P=0
108    000160 c2 90    CLR   P1.0
109 > </pre>
110
111 After execution of actual instruction pointed by PC the <b>step</b>
112 command dumps out the register set.
113
114 <hr>
115
116
117 <a name="n"><h3>n,next</h3></a>
118
119 Execute until next instruction is reached. This command is similar to
120 <a href="#s"><b>step</b></a> command described above but if actual
121 instruction to execute is a subroutine call the <b>next</b> command
122 places a dynamic breakpoint after the call instruction and starts to
123 execute the subroutine. If the subroutine is infinite the breakpoint
124 set by <b>next</b> will never reached. It can be a dangerous situation
125 because the executeion started by the <b>next</b> command can not be
126 stopped interactively. But it can be stopped by other breakpoints.
127
128 <pre>
129 $ <font color="#118811">s51 remoansi.hex</font>
130 ucsim 0.2.12, Copyright (C) 1997 Daniel Drotos, Talker Bt.
131 ucsim comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
132 This is free software, and you are welcome to redistribute it
133 under certain conditions; type `show c' for details.
134 58659 bytes read from remoansi.hex
135 > <font color="#118811">run 0 0x172</font>
136    000172 79 04    MOV   R1,#04
137 > <font color="#118811">dis 0x172 0 5</font>
138    000170 7f 00    MOV   R7,#00
139    000172 79 04    MOV   R1,#04
140    000174 12 0d b8 LCALL 0db8
141    000177 0f       INC   R7
142    000178 d9 fa    DJNZ  R1,0174
143    00017a 75 0b 00 MOV   0b,#00
144 > <font color="#118811">n</font>
145 000000 00 04 00 00 00 00 00 00 ........
146 000000 00 .  ACC= 0x00   0 .  B= 0x00   DPTR= 0x0000 @DPTR= 0x00   0 .
147 000004 00 .  PSW= 0x00 CY=0 AC=0 OV=0 P=0
148    000174 12 0d b8 LCALL 0db8
149 > <font color="#118811">n</font>
150 000000 00 04 00 00 00 00 00 00 ........
151 000000 00 .  ACC= 0x00   0 .  B= 0x00   DPTR= 0x0167 @DPTR= 0x00   0 .
152 000004 00 .  PSW= 0x00 CY=0 AC=0 OV=0 P=0
153    000177 0f       INC   R7
154 > </pre>
155
156 <hr>
157
158
159 <a name="pc"><h3>pc [address]</h3></a>
160
161 Using this command without any parameter it simply dumps out
162 instruction pointed by the PC. Specify address if you want to set the
163 PC.
164
165 <pre>
166 $ s51
167 S51 0.1.5, Copyright (C) 1997 Daniel Drotos, Talker Bt.
168 S51 comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
169 This is free software, and you are welcome to redistribute it
170 under certain conditions; type `show c' for details.
171 > <font color="#118811">pc</font>
172  * 000000 ff       MOV   R7,A
173 > <font color="#118811">pc 123</font>
174  * 00007b ff       MOV   R7,A
175 > <font color="#118811">sopt debug t </font> 
176 > <font color="#118811">pc 32</font>
177 Warning: maybe not instruction at 000020
178  * 000020 ff       MOV   R7,A
179 > </pre>
180
181 <hr>
182
183
184 <!--OK-->
185
186 </body>
187 </html>