Parameters are optional. First parameter specifies the start address for execution. By default, execution starts at the address specified by the PC's actual value. This can be overridden by the first parameter.
If second parameter is specified, it places a dynamic breakpoint at the specified address, which stops the execution at that address. If a stop address is not given the simulator stops if it reaches a breakpoint that was previously set, or the CPU accepts an interrupt and stopit option is TRUE, or fatal error occurs or stop command is used on an other console, or ENTER key is pressed on the console where the run command was issued.
When program execution is started, the console becomes frozen; it is not possible to give commands on this console to the simulator while execution is running. If it is needed to control the simulator during program execution then more consoles can be used. See using multiple consoles for more information. Meanwhile, simulation can be stopped by pressing the ENTER key (or type in a command and ENTER) on the frozen console (where the run command was issued).
If run command is used in a script (standard input or file parameter for -C option), the execution of the script is always suspended on the run command. The script resumes after execution stops.
However, it is possible to start the simulation in the background by setting the sim_run variable to a logical TRUE (i.e. non-zero) value, like:
$ ucsim_51 uCsim 0.9.10, 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> load "remo.hex" Loading from remo.hex 55755 words read from remo.hex 0> sim_run=1 1 0> info reg R0 R1 R2 R3 R4 R5 R6 R7 18 00 46 83 00 00 00 00 @R0 c2 . ACC= 0x00 0 . B= 0x00 @R1 18 . PSW= 0x00 CY=0 AC=0 OV=0 P=0 SP 0x2e -> 77 f3 79 84 c9 28 24 e4 DPTR= 0x000e @DPTR= 0x00 0 . 0x7057 ff MOV R7,A 0>
Note that the first instruction is executed without the effect of breakpoints and simulation will be started afterwards. It means that if there is a breakpoint at start address then it will not be hit. See following example:
$ ucsim_51 uCsim 0.9.10, 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> b 0x10 Breakpoint 1 at 0x000010 (cond="") 0x0010 F ff MOV R7,A 0> b 0x20 Breakpoint 2 at 0x000020 (cond="") 0x0020 F ff MOV R7,A 0> run 0x10 Simulation started, PC=0x000010 Stop at 0x000020: (104) Breakpoint R0 R1 R2 R3 R4 R5 R6 R7 41 58 fc c9 8b bc 95 00 @R0 76 v ACC= 0x00 0 . B= 0x00 @R1 73 s PSW= 0x00 CY=0 AC=0 OV=0 P=0 SP 0x07 -> 00 95 bc 8b c9 fc 58 41 DPTR= 0x0000 @DPTR= 0x83 131 . 0x0020 F ff MOV R7,A F 0x000020 Simulated 192 ticks (1.736e-05 sec) Host usage: 0.000004 sec, rate=4.283399 0>
In emulation mode the simulation cannot be stopped by any user interaction. Breakpoints or the simulator interface must be used to stop the simulation.
$ ucsim_51 uCsim 0.9.10, 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> load "remo.hex" Loading from remo.hex 55755 words read from remo.hex 0> sim_run=1 1 0> info reg R0 R1 R2 R3 R4 R5 R6 R7 18 00 46 83 00 00 00 00 @R0 c2 . ACC= 0x00 0 . B= 0x00 @R1 18 . PSW= 0x00 CY=0 AC=0 OV=0 P=0 SP 0x2e -> 77 f3 79 84 c9 28 24 e4 DPTR= 0x000e @DPTR= 0x00 0 . 0x7057 ff MOV R7,A 0> info reg R0 R1 R2 R3 R4 R5 R6 R7 18 01 00 d2 00 01 00 31 @R0 67 g ACC= 0x31 49 1 B= 0x00 @R1 01 . PSW= 0x01 CY=0 AC=0 OV=0 P=1 SP 0x28 -> 25 d7 29 81 02 2d 06 27 DPTR= 0x00d2 @DPTR= 0x31 49 1 0x367d 20 0c 02 JB 0x0c,0x3682 0> stop 0x93c7 90 09 30 MOV DPTR,#0x0930 0>After using the stop command, the instruction pointed by PC is disassembled, see the dis command for description of disassembled form.
The optional parameter can be used to specify the number of instructions to execute. Note that breakpoints will stop the execution after the first instruction.
$ ucsim_51 uCsim 0.9.10, 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> load "remo.hex" Loading from remo.hex 55755 words read from remo.hex 0> step Stop at 0x000160: (109) stepped 24 ticks 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 . 0x0160 c2 90 CLR 0x900x90 <P1>.0 F 0x000160 0> step 1 s Stop at 0x004366: (104) Breakpoint R0 R1 R2 R3 R4 R5 R6 R7 0c 01 0b 8f 00 86 0c 00 @R0 00 . ACC= 0x00 0 . B= 0x00 @R1 01 . PSW= 0xc0 CY=1 AC=1 OV=0 P=0 SP 0x26 -> 2a ae 02 2d 3e 37 bc 00 DPTR= 0x000e @DPTR= 0x00 0 . 0x4366 90 00 0a MOV DPTR,#0x000a F 0x004366 Simulated 11059212 ticks (1.000e+00 sec) Host usage: 0.112313 sec, rate=8.903696 0> step 100 vclk Stop at 0x004396: (104) Breakpoint R0 R1 R2 R3 R4 R5 R6 R7 0c 01 0b 8f 00 86 0c 00 @R0 00 . ACC= 0x00 0 . B= 0x00 @R1 01 . PSW= 0xc0 CY=1 AC=1 OV=0 P=0 SP 0x26 -> 2a ae 02 2d 3e 37 bc 00 DPTR= 0x000b @DPTR= 0x00 0 . 0x4396 ff MOV R7,A F 0x004396 Simulated 672 ticks (6.076e-05 sec) Host usage: 0.000012 sec, rate=5.097244 0>
After execution of the actual instruction pointed by PC (or all instructions specified by the optional parameter) the step command dumps out the register set.
The number of steps can be specified in different units. If no unit is appended to step number then it will be interpreted as the number of instruction. Other know units are:
$ ucsim_51 uCsim 0.9.10, 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> load "remo.hex" Loading from remo.hex 55755 words read from remo.hex 0> run 0 0x172 Simulation started, PC=0x000000 Stop at 0x000172: (104) Breakpoint R0 R1 R2 R3 R4 R5 R6 R7 41 58 fc c9 8b bc 00 00 @R0 76 v ACC= 0x00 0 . B= 0x00 @R1 73 s PSW= 0x00 CY=0 AC=0 OV=0 P=0 SP 0x22 -> 1d 84 43 31 94 d0 c9 03 DPTR= 0x0000 @DPTR= 0x83 131 . 0x0172 79 04 MOV R1,#0x04 F 0x000172 Simulated 144 ticks (1.302e-05 sec) Host usage: 0.000014 sec, rate=0.925650 0> disass 0x172 0 5 Removed command, use "dc" instead 0> next Stop at 0x000174: (109) stepped 12 ticks R0 R1 R2 R3 R4 R5 R6 R7 41 04 fc c9 8b bc 00 00 @R0 76 v ACC= 0x00 0 . B= 0x00 @R1 8b . PSW= 0x00 CY=0 AC=0 OV=0 P=0 SP 0x22 -> 1d 84 43 31 94 d0 c9 03 DPTR= 0x0000 @DPTR= 0x83 131 . 0x0174 12 09 f9 LCALL 0x09f9 F 0x000174 0> n Stop at 0x000177: (104) Breakpoint R0 R1 R2 R3 R4 R5 R6 R7 41 04 fc c9 8b bc 00 00 @R0 76 v ACC= 0x00 0 . B= 0x00 @R1 8b . PSW= 0x00 CY=0 AC=0 OV=0 P=0 SP 0x22 -> 1d 84 43 31 94 d0 c9 03 DPTR= 0x0149 @DPTR= 0x00 0 . 0x0177 0f INC R7 F 0x000177 Simulated 492 ticks (4.449e-05 sec) Host usage: 0.000015 sec, rate=2.961834 0>
$ ucsim_51 uCsim 0.9.10, 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> pc 0x0000 ff MOV R7,A 0> pc 123 0x007b ff MOV R7,A 0> info reg 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 . 0x007b ff MOV R7,A 0>
history
history information
history list
history clear
history
This command (without a subcommand) prints out the last 10 elements of the command history in disassembled form.$ ucsim_51 uCsim 0.9.10, 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> load "remo.hex" Loading from remo.hex 55755 words read from remo.hex 0> step 10 Stop at 0x000174: (109) stepped 156 ticks R0 R1 R2 R3 R4 R5 R6 R7 41 04 fc c9 8b bc 00 00 @R0 76 v ACC= 0x00 0 . B= 0x00 @R1 8b . PSW= 0x00 CY=0 AC=0 OV=0 P=0 SP 0x22 -> 1d 84 43 31 94 d0 c9 03 DPTR= 0x0000 @DPTR= 0x83 131 . 0x0174 12 09 f9 LCALL 0x09f9 F 0x000174 Simulated 156 ticks (1.411e-05 sec) Host usage: 0.000015 sec, rate=0.939118 0> history 0x0000 02 01 60 LJMP 0x0160 0x0160 c2 90 CLR 0x900x90 <P1>.0 0x0162 c2 97 CLR 0x970x90 <P1>.7 0x0164 d2 b5 SETB 0xb50xb0 <P3>.5 0x0166 d2 b4 SETB 0xb40xb0 <P3>.4 0x0168 75 81 22 MOV 0x81 <SP>,#0x22 0x016b 75 d0 00 MOV 0xd0 <PSW>,#0x00 0x016e 7e 00 MOV R6,#0x00 0x0170 7f 00 MOV R7,#0x00 0x0172 79 04 MOV R1,#0x04 0>
history information
Print out information about execution history.$ ucsim_51 uCsim 0.9.10, 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> load "remo.hex" Loading from remo.hex 55755 words read from remo.hex 0> step 20 Stop at 0x000a13: (109) stepped 324 ticks R0 R1 R2 R3 R4 R5 R6 R7 41 04 fc c9 8b bc 00 00 @R0 76 v ACC= 0x80 128 . B= 0x00 @R1 8b . PSW= 0x01 CY=0 AC=0 OV=0 P=1 SP 0x27 -> 00 09 fe 01 77 1d 84 43 DPTR= 0xff00 @DPTR= 0x04 4 . 0x0a13 2f ADD A,R7 F 0x000a13 Simulated 324 ticks (2.930e-05 sec) Host usage: 0.000019 sec, rate=1.536000 0> history info len: 10000 used: 20 insts: 20 0>Len is the size of the history, used shows how many slots are filled, and insts is the number of the instructions recorded by the history.
history list [nr]
This command is the same as the history command, but it accepts a parameter that specifies how many records to print (defaults to 10):
history print [nr]$ ucsim_51 uCsim 0.9.10, 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> load "remo.hex" Loading from remo.hex 55755 words read from remo.hex 0> step 1000 Stop at 0x000201: (109) stepped 20568 ticks R0 R1 R2 R3 R4 R5 R6 R7 12 57 fc c9 09 f0 12 bd @R0 df . ACC= 0x14 20 . B= 0x00 @R1 41 A PSW= 0x00 CY=0 AC=0 OV=0 P=0 SP 0x2a -> 01 ba 23 87 29 81 02 2d DPTR= 0x1257 @DPTR= 0x1f 31 . 0x0201 a3 INC DPTR F 0x000201 Simulated 20568 ticks (1.860e-03 sec) Host usage: 0.000188 sec, rate=9.886698 0> history info len: 10000 used: 1000 insts: 1000 0> history list 3 0x01fc 70 01 JNZ 0x01ff 0x01ff e4 CLR A 0x0200 93 MOVC A,@A+DPTR 0> history list 0x0212 89 82 MOV 0x82 <DPL>,R1 0x0214 80 e3 SJMP 0x01f9 0x01f9 12 01 9f LCALL 0x019f 0x019f ef MOV A,R7 0x01a0 65 82 XRL A,0x82 <DPL> 0x01a2 70 03 JNZ 0x01a7 0x01a7 22 RET 0x01fc 70 01 JNZ 0x01ff 0x01ff e4 CLR A 0x0200 93 MOVC A,@A+DPTR 0>
history clear
This command clears the history; it deletes all recorded elements.$ ucsim_51 uCsim 0.9.10, 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> load "remo.hex" Loading from remo.hex 55755 words read from remo.hex 0> step 1000 Stop at 0x000201: (109) stepped 20568 ticks R0 R1 R2 R3 R4 R5 R6 R7 12 57 fc c9 09 f0 12 bd @R0 df . ACC= 0x14 20 . B= 0x00 @R1 41 A PSW= 0x00 CY=0 AC=0 OV=0 P=0 SP 0x2a -> 01 ba 23 87 29 81 02 2d DPTR= 0x1257 @DPTR= 0x1f 31 . 0x0201 a3 INC DPTR F 0x000201 Simulated 20568 ticks (1.860e-03 sec) Host usage: 0.001160 sec, rate=1.603413 0> history list 5 0x01a2 70 03 JNZ 0x01a7 0x01a7 22 RET 0x01fc 70 01 JNZ 0x01ff 0x01ff e4 CLR A 0x0200 93 MOVC A,@A+DPTR 0> history clear 0> history info len: 10000 used: 0 insts: 0 0>