ucsim-0.2.37-pre3 into cvs
[fw/sdcc] / sim / ucsim / doc / cmd_exec.html
1 <html>
2 <head>
3 <title>Execution commands of uCsim</title>
4 </head>
5
6 <body bgcolor="white">
7
8                                                                  <!-- EXEC -->
9 <h2>Execution commands of uCsim</h2>
10
11
12 <a name="g"><h3>g [start [stop]]</h3></a>
13
14 Go, start execution. Parameters are optional. First parameter
15 specifies start address of the execution. By default execution starts
16 at address specified by actual value of the PC. This can be overridden
17 by first parameter. If second parameter is specified it places a
18 dynamic breakpoint at specified address which stops the execution. If
19 stop address is not given the simulator stops if it reaches a
20 breakpoint, or the CPU accepts an interrupt and <b>stopit</b> option
21 is TRUE, or fatal error occures or <a href="#stop">stop</a> command is
22 used. Note that first instruction is executed without effect of
23 breakpoints. It means that if there is a breakpoint at start address
24 then it will not be hit.
25
26 <pre>
27 $ <font color="#118811">s51 remoansi.hex</font>
28 ucsim 0.2.24, Copyright (C) 1997 Daniel Drotos, Talker Bt.
29 ucsim comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
30 This is free software, and you are welcome to redistribute it
31 under certain conditions; type `show c' for details.
32 55755 bytes read from remoansi.hex
33 > <font color="#118811">b 0x187</font>
34 > <font color="#118811">sopt stopit y</font>
35 > <font color="#118811">g</font>
36 Simulation started, PC=0x000000
37 Stop at 000187: (4) Breakpoint
38 F 000187
39 > </pre>
40
41 After execution is started the <tt>Simulaton started</tt> message
42 appears with value of PC where the execution started and the simulator
43 is ready to accept other commands while the simulation is running in
44 background.
45
46 <!--If execution stops the simulator first writes out a number which is
47 the reason of the stop (this is a diagnostic feature, it will be
48 improved in future versions). Reason can be:
49
50 <dl><dt>0
51
52 <dd>There is no reason to stop. This number should never appear.
53
54 <dt>1
55
56 <dd>Serious error for example unknown instruction code which is
57 impossible to execute.
58
59 <dt>2
60
61 <dd>Invalid address used in an instruction. For example indirect
62 address is bigger then 127 in 51 type of controller. Execution can be
63 continued but result will be undefined.
64
65 <dt>3
66
67 <dd>Stack overflow. Execution can be continued but result will be
68 undefined.
69
70 <dt>4
71
72 <dd>Breakpoint has been reached.
73
74 <dt>5
75
76 <dd>Interrupt accepted. It only stops the execution if <b>stopit</b>
77 option is set to TRUE. See <a href="#sopt">sopt</a> command.
78
79 </dl>
80
81 After this diagnostic message the simulator prints out intruction at
82 the PC in disassembled form. See <a href="#dis"><b>dis</b></a>
83 commands for description of disassembled form.
84 -->
85
86
87 <a name="stop"><h3>stop</h3></a>
88
89 This command stops the simulation, it freezes the CPU and all the
90 peripherials.
91
92 <pre>
93 $ <font color="#118811">s51 remoansi.hex</font>
94 ucsim 0.2.24, Copyright (C) 1997 Daniel Drotos, Talker Bt.
95 ucsim comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
96 This is free software, and you are welcome to redistribute it
97 under certain conditions; type `show c' for details.
98 58659 bytes read from remoansi.hex
99 > <font color="#118811">g</font>
100 Simulation started
101 > <font color="#118811">dr</font>
102 000000 00 01 00 14 00 00 5a 47 ......ZG
103 000000 00 .  ACC= 0x47  71 G  B= 0x01   DPTR= 0x001c @DPTR= 0x47  71 G
104 000001 01 .  PSW= 0x00 CY=0 AC=0 OV=0 P=0
105    006f02 90 00 1e MOV   DPTR,#001e
106 > <font color="#118811">stop</font>
107    006ac5 24 a5    ADD   A,#a5
108
109 </pre>
110
111 Simulated program is executed in background and the simulator accepts
112 commands. If it stopped by the stop command the instruction pointed by
113 PC is dissassembled, see the <a href="#dis"><b>dis</b></a> command for
114 description of disassembled form.
115
116
117 <a name="s"><h3><img src="burst.gif" alt="[Repeatable]"> s
118 [step]</h3></a>
119
120 Step command. It executes one instruction without effect of
121 breakpoints. Optional parameter can specify number of requested
122 steps.
123
124 <pre>
125 $ <font color="#118811">s51 remoansi.hex</font>
126 ucsim 0.2.12, Copyright (C) 1997 Daniel Drotos, Talker Bt.
127 ucsim comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
128 This is free software, and you are welcome to redistribute it
129 under certain conditions; type `show c' for details.
130 58659 bytes read from remoansi.hex
131 > <font color="#118811">s</font>
132 000000 00 00 00 00 00 00 00 00 ........
133 000000 00 .  ACC= 0x00   0 .  B= 0x00   DPTR= 0x0000 @DPTR= 0x00   0 .
134 000000 00 .  PSW= 0x00 CY=0 AC=0 OV=0 P=0
135    000160 c2 90    CLR   P1.0
136 > <font color="#118811">s 2</font>
137 000000 00 00 00 00 00 00 00 00 ........
138 000000 00 .  ACC= 0x00   0 .  B= 0x00   DPTR= 0x0000 @DPTR= 0x00   0 .
139 000000 00 .  PSW= 0x00 CY=0 AC=0 OV=0 P=0
140    000162 c2 97    CLR   P1.7
141 000000 00 00 00 00 00 00 00 00 ........
142 000000 00 .  ACC= 0x00   0 .  B= 0x00   DPTR= 0x0000 @DPTR= 0x00   0 .
143 000000 00 .  PSW= 0x00 CY=0 AC=0 OV=0 P=0
144    000164 d2 b5    SETB  P3.5
145 > </pre>
146
147 After execution of actual instruction pointed by PC the <b>step</b>
148 command executes <a href="#dr"><b>dr</b></a> command.
149
150
151 <a name="n"><h3><img src="burst.gif" alt="[Repeatable]"> n
152 [step]</h3></a>
153
154 Execute until next instruction is reached. This command is similar to
155 <a href="#s"><b>step</b></a> command described above but if actual
156 instruction to execute is a subroutine call the <b>next</b> command
157 places a dynamic breakpoint after the call instruction and starts to
158 execute the subroutine. If the subroutine is infinite the breakpoint
159 set by <b>next</b> will never reached. It can be a dangerous situation
160 because the executeion started by the <b>next</b> command can not be
161 stopped interactively. But it can be stopped by other breakpoints.
162
163 <pre>
164 $ <font color="#118811">s51 remoansi.hex</font>
165 ucsim 0.2.12, Copyright (C) 1997 Daniel Drotos, Talker Bt.
166 ucsim comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
167 This is free software, and you are welcome to redistribute it
168 under certain conditions; type `show c' for details.
169 58659 bytes read from remoansi.hex
170 > <font color="#118811">g 0 0x172</font>
171 4
172    000172 79 04    MOV   R1,#04
173 > <font color="#118811">dis 0x172 0 5</font>
174    000170 7f 00    MOV   R7,#00
175    000172 79 04    MOV   R1,#04
176    000174 12 0d b8 LCALL 0db8
177    000177 0f       INC   R7
178    000178 d9 fa    DJNZ  R1,0174
179    00017a 75 0b 00 MOV   0b,#00
180 > <font color="#118811">n 3</font>
181 000000 00 04 00 00 00 00 00 00 ........
182 000000 00 .  ACC= 0x00   0 .  B= 0x00   DPTR= 0x0000 @DPTR= 0x00   0 .
183 000004 00 .  PSW= 0x00 CY=0 AC=0 OV=0 P=0
184    000174 12 0d b8 LCALL 0db8
185 000000 00 04 00 00 00 00 00 00 ........
186 000000 00 .  ACC= 0x00   0 .  B= 0x00   DPTR= 0x0167 @DPTR= 0x00   0 .
187 000004 00 .  PSW= 0x00 CY=0 AC=0 OV=0 P=0
188    000177 0f       INC   R7
189 000000 00 04 00 00 00 00 00 01 ........
190 000000 00 .  ACC= 0x00   0 .  B= 0x00   DPTR= 0x0167 @DPTR= 0x00   0 .
191 000004 00 .  PSW= 0x00 CY=0 AC=0 OV=0 P=0
192    000178 d9 fa    DJNZ  R1,0174
193 > </pre>
194
195
196 <a name="pc"><h3>pc [address]</h3></a>
197
198 Using this command without any parameter it simply dumps out
199 instruction pointed by the PC. Specify address if you want to set the
200 PC.
201
202 <pre>
203 $ s51
204 S51 0.1.5, Copyright (C) 1997 Daniel Drotos, Talker Bt.
205 S51 comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
206 This is free software, and you are welcome to redistribute it
207 under certain conditions; type `show c' for details.
208 > <font color="#118811">pc</font>
209  * 000000 ff       MOV   R7,A
210 > <font color="#118811">pc 123</font>
211  * 00007b ff       MOV   R7,A
212 > <font color="#118811">sopt debug t </font> 
213 > <font color="#118811">pc 32</font>
214 Warning: maybe not instruction at 000020
215  * 000020 ff       MOV   R7,A
216 > </pre>
217
218
219 <a name="run"><h3>run</h3></a>
220
221 This command starts the execution of the simulated program.
222
223
224 <hr>
225
226 </body>
227 </html>