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