Some commands accept parameters which in most cases can be numbers. Numbers can be entered in C-style form. If the number begins whith 0x or 0X it is interpreted as a hexadecimal number. If it begins with 0 followed by digits it is interpreted as octal number. In other cases it is interpreted as decimal number.
Every command which changes content of ROM area such as l, dl or sc deletes result of code analyzer and causes to
re-analyze the code.
show c|w
This command can be used to list licensing information. If c
option has given, the license is listed. It is first 10 point of the
version 2 of GNU Genral Public License. Using w parameter the
command prints out last 2 point of the license ("NO WARRANTY"
message). If you do not accept GPL simply do not use the program.
l file
Loading specified files into simulated ROM area. File must hold
information in Intel hex form.
$ s51 ucsim 0.2.12, 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. > l ../remoansi.hex 58659 bytes read from ../remoansi.hex >
$ s51 -V 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. > do :03000000020003F8 :1000030075812078207600D8FC900000AE83AF8203 :100013009000001200416005E4F0A380F690009F79 :1000230012004A9000A312004A9000A712006890A1 :1000330000AD12006875D0001200B50200B3EF6581 :10004300827003EE658322E493F8740193F97402DA :1000530093FE740393F5828E83E869700122E4931F :10006300F6A30880F4E493FC740193FD740293FEF9 :10007300740393FF740493F8740593F582888312D1 :100083000041700122E493A3A883A9828C838D820B :10009300F0A3AC83AD828883898280E3212100B5FC :1000A300212100B5000000B500B5000000B500B582 :0200B30080FECD :1000B5007520117501AA850120750102850120228F :00000001FF 15 records have been read 197 bytes read >
Note that if -Z option was used at invokation then the quit command does not terminate the simulator program. In this case kill command can be used to terminate the simulator. See for more information about using multiple consoles.
$ s51 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. > q $
Example
reset
Reset command. It resets the microcontroller. It has same effect as
active signal on the RST pin.
$ s51 -V remoansi.hex 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 > dr 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 > s 2 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 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 > res > dr 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 >
$ s51 remoansi.hex 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 > g Simulation started, PC=0x000000 Stop at 00019c: (7) User stopped F 00019c > si 20 Dani DAni 000014 44 61 6e 69 44 41 6e 69 DaniDAni > wi dani 000014 44 61 6e 69 Dani 000018 44 41 6e 69 DAni > Wi Dani 000014 44 61 6e 69 Dani > wi dani\0 000018 44 41 6e 69 00 DAni. >
$ s51 -V 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. > gopt verbose TRUE Verbose flag. stopit FALSE Stop if interrupt accepted. debug FALSE Debug flag. > gopt stopit stopit FALSE Stop if interrupt accepted. >This version of the simulator knows about three options. First element of the list is name of the option (verbose, debug and stopit). This name can be used to identify the option in gopt and sopt command. Second element of the list is the value of the option. In this case type of both options is boolean, their value can be TRUE or FALSE. Third element is a short description of the option.
$ s51 -V 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. > gopt verbose TRUE Verbose flag. stopit FALSE Stop if interrupt accepted. debug FALSE Debug messages appears on this console. > sopt debug t > gopt verbose TRUE Verbose flag. stopit FALSE Stop if interrupt accepted. debug TRUE Debug messages appears on this console. >
> conf ucsim version 0.2.24 Type of microcontroller: 51 CMOS Controller has 0 hardware element(s). Memories: ROM size= 0x010000 65536 XRAM size= 0x010000 65536 IRAM size= 0x000100 256 SFR size= 0x000100 256 >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. This has meaning in AVR simulator only. Following lines contain information about memories. Note that size of the simulated memory segment can be bigger than size of addressable part of the memory as you see above SFR type of the memory has bigger simulated than addressable size.
> state sim state= 0 PC= 0007a9 XTAL= 1.10592e+07 time= 0.306849 sec (3393504 clks) time in isr= 0.00100694 (11136 clks) 0.33% >The "sim state" number in the first line is an internal information. PC is value of the program counter. Second line shows XTAL frequency.
Third line contains 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. Last data shows ratio of ISRs and main
program.
file "FILE"
Loads file named FILE into the simulated code memory. File must
contain data in Intel HEX format.
> file "../../remo.hex" 55470 words read from ../../remo.hex >Don't forget to enclose file name in quotes to make the parameter to be a string.
> b 12 Breakpoint 1 at 0x00000c: MOV R7,A > tb 43 Breakpoint 2 at 0x00002b: MOV R7,A > bse ws f 0x80 > i b 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 1 event keep 1 1 0x000080 ws >As you see above, the command can be shortened to "i b". The list of breakpoints contains 7 columns:
> tim a 3 > tim g 0 timer #0("time") ON: 0.463255 sec (5123232 clks) timer #0("isr") ON: 0.0051888 sec (57384 clks) timer #3("unnamed") ON: 0 sec (0 clks) > tim a "a" > tim g 0 timer #0("time") ON: 0.463255 sec (5123232 clks) timer #0("isr") ON: 0.0051888 sec (57384 clks) timer #1("a") ON: 0 sec (0 clks) timer #3("unnamed") ON: 0 sec (0 clks) >If you use 0 as timer id in "get" operation, simulator prints out value of all timers including predefined ones.
$ s51 remoansi.hex 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. 55755 bytes read from remoansi.hex > b 0x187 > sopt stopit y > g Simulation started, PC=0x000000 Stop at 000187: (4) Breakpoint F 000187 >After execution is started the Simulaton started message appears with value of PC where the execution started and the simulator is ready to accept other commands while the simulation is running in background.
$ s51 remoansi.hex 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 > g Simulation started > dr 000000 00 01 00 14 00 00 5a 47 ......ZG 000000 00 . ACC= 0x47 71 G B= 0x01 DPTR= 0x001c @DPTR= 0x47 71 G 000001 01 . PSW= 0x00 CY=0 AC=0 OV=0 P=0 006f02 90 00 1e MOV DPTR,#001e > stop 006ac5 24 a5 ADD A,#a5 >Simulated program is executed in background and the simulator accepts commands. If it stopped by the stop command the instruction pointed by PC is dissassembled, see the dis command for description of disassembled form.
$ s51 remoansi.hex ucsim 0.2.12, 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 > s 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 > s 2 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 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 000164 d2 b5 SETB P3.5 >After execution of actual instruction pointed by PC the step command executes dr command.
$ s51 remoansi.hex ucsim 0.2.12, 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 > g 0 0x172 4 000172 79 04 MOV R1,#04 > dis 0x172 0 5 000170 7f 00 MOV R7,#00 000172 79 04 MOV R1,#04 000174 12 0d b8 LCALL 0db8 000177 0f INC R7 000178 d9 fa DJNZ R1,0174 00017a 75 0b 00 MOV 0b,#00 > n 3 000000 00 04 00 00 00 00 00 00 ........ 000000 00 . ACC= 0x00 0 . B= 0x00 DPTR= 0x0000 @DPTR= 0x00 0 . 000004 00 . PSW= 0x00 CY=0 AC=0 OV=0 P=0 000174 12 0d b8 LCALL 0db8 000000 00 04 00 00 00 00 00 00 ........ 000000 00 . ACC= 0x00 0 . B= 0x00 DPTR= 0x0167 @DPTR= 0x00 0 . 000004 00 . PSW= 0x00 CY=0 AC=0 OV=0 P=0 000177 0f INC R7 000000 00 04 00 00 00 00 00 01 ........ 000000 00 . ACC= 0x00 0 . B= 0x00 DPTR= 0x0167 @DPTR= 0x00 0 . 000004 00 . PSW= 0x00 CY=0 AC=0 OV=0 P=0 000178 d9 fa DJNZ R1,0174 >
$ s51 S51 0.1.5, Copyright (C) 1997 Daniel Drotos, Talker Bt. S51 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. > pc * 000000 ff MOV R7,A > pc 123 * 00007b ff MOV R7,A > sopt debug t > pc 32 Warning: maybe not instruction at 000020 * 000020 ff MOV R7,A >
Event breakpoints are special onces. They cause stop of execution if event specified by the breakpoint occures. Events are:
Every breakpoint can be fix (permanent) or dynamic (temporary). Dynamic breakpoints are automatically removed when they reached. Some commands place dynamic fetch breakpoints into the code, for example go or next.
A hit number can be associated to any breakpoint. This hit
number specifies how many times the breakpoint must be hit before it
causes the execution to stop. This hit number is 1 by default.
break addr [hit]
tbreak addr [hit]
Set fetch breakpoint. The command specifies if the breakpoint will be
fix (break) or dynamic (temporary) (tbreak). First
parameter specifies address where the breakpoint must be placed to. It
should be address of an instruction.
Second parameter is optional and it specifies the hit number. It is 1 by default.
$ s51 remoansi.hex 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 > dc 0 0x10 000000 02 01 60 LJMP 0160 * 000003 02 00 3c LJMP 003c * 000006 ff MOV R7,A * 000007 ff MOV R7,A * 000008 ff MOV R7,A * 000009 ff MOV R7,A * 00000a ff MOV R7,A * 00000b 02 3b e0 LJMP 3be0 * 00000e ff MOV R7,A * 00000f ff MOV R7,A * 000010 ff MOV R7,A > break 0x160 Breakpoint 1 at 0x000160: CLR P1.0 > tbreak 8 2 Breakpoint 2 at 0x000008: MOV R7,A > g Simulation started, PC=0x000000 Stop at 000160: (4) Breakpoint F 000160 >
Forth parameter is optional and it specifies the hit number. It is 1 by default.
$ s51 remoansi.hex ucsim 0.2.12, 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 > dis 00d47e 22 RET 000000 02 01 60 LJMP 0160 000160 c2 90 CLR P1.0 000162 c2 97 CLR P1.7 000164 d2 b5 SETB P3.5 000166 d2 b4 SETB P3.4 000168 75 81 22 MOV SP,#22 00016b 75 d0 00 MOV PSW,#00 00016e 7e 00 MOV R6,#00 000170 7f 00 MOV R7,#00 000172 79 04 MOV R1,#04 000174 12 0d b8 LCALL 0db8 000177 0f INC R7 000178 d9 fa DJNZ R1,0174 00017a 75 0b 00 MOV 0b,#00 00017d 75 0c 00 MOV 0c,#00 000180 02 02 2a LJMP 022a 000183 78 22 MOV R0,#22 000185 76 00 MOV @R0,#00 000187 d8 fc DJNZ R0,0185 > bse wi f 6 > g 4 000170 7f 00 MOV R7,#00 >
If parameter is not given then breakpoint at current PC will be deleted if it exists. If more than one address is specified then all breakpoints at specified addresses will be deleted.
> i b Num Type Disp Hit Cnt Address What 1 fetch keep 1 1 0x000160 CLR P1.0 2 fetch del 1 1 0x000180 LJMP 022a 1 event keep 1 1 0x000006 wi > clear 160 No breakpoint at 0000a0 > clear 0x160 > i b Num Type Disp Hit Cnt Address What 2 fetch del 1 1 0x000180 LJMP 022a 1 event keep 1 1 0x000006 wi >
> bl D 2(2) 000180 02 LJMP 022a F 1(1) 000006 wi > bde ri 6 No ri breakpoint at 000006 > bde wi 6 > bl D 2(2) 000180 02 LJMP 022a >
> bl F 1(1) 000160 c2 CLR P1.0 D 2(2) 000180 02 LJMP 022a F 1(1) 000006 wi > ba > bl >
In third parameter you can specify how many instructions you want to list. Default value is 20.
$ s51 remoansi.hex ucsim 0.2.12, 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 > dis 00d47e 22 RET 000000 02 01 60 LJMP 0160 000160 c2 90 CLR P1.0 000162 c2 97 CLR P1.7 000164 d2 b5 SETB P3.5 000166 d2 b4 SETB P3.4 000168 75 81 22 MOV SP,#22 00016b 75 d0 00 MOV PSW,#00 00016e 7e 00 MOV R6,#00 000170 7f 00 MOV R7,#00 000172 79 04 MOV R1,#04 000174 12 0d b8 LCALL 0db8 000177 0f INC R7 000178 d9 fa DJNZ R1,0174 00017a 75 0b 00 MOV 0b,#00 00017d 75 0c 00 MOV 0c,#00 000180 02 02 2a LJMP 022a 000183 78 22 MOV R0,#22 000185 76 00 MOV @R0,#00 000187 d8 fc DJNZ R0,0185 > bs f 0x180 > bs d 0x189 > dis 0x180 -3 10 000178 d9 fa DJNZ R1,0174 00017a 75 0b 00 MOV 0b,#00 00017d 75 0c 00 MOV 0c,#00 F 000180 02 02 2a LJMP 022a 000183 78 22 MOV R0,#22 000185 76 00 MOV @R0,#00 000187 d8 fc DJNZ R0,0185 D 000189 22 RET 00018a 90 09 ec MOV DPTR,#09ec 00018d ae 83 MOV R6,DPH >If there is an F or D character at the beginning of the line, it means that there is a fix or dynamic fetch breakpoint at listed address. Next element on the list can be an asterix (*) which means that the listed address is not marked by the code analyzer. dis lists marked instructions only so asterix never appears in the list. Next element of the list is address displayed as six digit hexadecimal number. Address is followed by hexadecimal dump of instruction's code. Last element of the list is disassembled instruction. Every number appeared on the list is hexadecimal number.
$ s51 remoansi.hex ucsim 0.2.12, 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 > dc 000000 02 01 60 LJMP 0160 * 000003 02 00 3c LJMP 003c * 000006 ff MOV R7,A * 000007 ff MOV R7,A * 000008 ff MOV R7,A * 000009 ff MOV R7,A * 00000a ff MOV R7,A * 00000b 02 3b e0 LJMP 3be0 * 00000e ff MOV R7,A * 00000f ff MOV R7,A * 000010 ff MOV R7,A * 000011 ff MOV R7,A * 000012 ff MOV R7,A * 000013 02 00 ac LJMP 00ac * 000016 ff MOV R7,A * 000017 ff MOV R7,A * 000018 ff MOV R7,A * 000019 ff MOV R7,A * 00001a ff MOV R7,A * 00001b ff MOV R7,A * 00001c ff MOV R7,A >
$ s51 remo.hex 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 > wc remo 0013da 52 65 6d 6f Remo > dch 0x13da 0013da 52 65 6d 6f 20 00 56 65 Remo .Ve 0013e2 72 73 69 6f 6e 20 31 2e rsion 1. 0013ea 30 20 00 43 6f 70 79 72 0 .Copyr 0013f2 69 67 68 74 20 28 63 29 ight (c) 0013fa 20 00 31 39 39 34 2c 39 .1994,9 001402 35 20 00 54 61 6c 6b 65 5 .Talke 00140a 72 20 42 74 2e 00 53 75 r Bt..Su 001412 6e 64 61 79 2e 00 4d 6f nday..Mo 00141a 6e 64 61 79 2e 00 54 68 nday..Th 001422 75 65 73 64 61 79 2e 00 uesday.. >First element in every lines is address of first byte dumped out in the line. Next elements are hexadecimal values of bytes followed by ASCII charactes of bytes dumped out in the line. If value of the memory cell is not printable than a dot is dumped out.
$ s51 remoansi.hex 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 > sopt stopit 1 > g Simulation started, PC=0x000000 Stop at 000023: (5) Interrupt F 000023 > di 000000 18 02 16 ba 00 02 00 0a ........ 000008 00 00 00 00 00 00 00 00 ........ 000010 00 00 00 00 00 00 00 00 ........ 000018 4a 00 00 00 00 00 00 00 J....... 000020 bc 27 06 2d 02 ee 35 8f .'.-..5. 000028 31 e7 42 01 0e 01 0b 00 1.B..... 000030 ec 0b 7f 10 7f a9 7e 08 ......~. 000038 fe 03 09 00 00 00 af 08 ........ 000040 af 08 00 00 00 00 00 00 ........ 000048 00 00 00 00 00 00 00 00 ........ >
$ s51 remoansi.hex 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 > sopt stopit 1 > g Simulation started, PC=0x000000 Stop at 000023: (5) Interrupt F 000023 > dx 0x100 000100 00 00 00 00 00 00 00 00 ........ 000108 00 00 00 00 00 00 00 00 ........ 000110 00 00 00 00 00 00 00 00 ........ 000118 00 00 00 00 00 00 00 00 ........ 000120 00 00 00 00 00 00 00 00 ........ 000128 00 00 00 00 00 00 00 44 .......D 000130 61 6e 69 00 00 00 02 02 ani..... 000138 07 00 00 ff 00 00 07 cb ........ 000140 08 0c 32 00 07 cb 06 05 ..2..... 000148 02 00 24 00 00 00 00 00 ..$..... >
$ s51 remoansi.hex ucsim 0.2.12, 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 > sopt stopit 1 > g 5 * 000023 02 01 1c LJMP 011c > dr 000000 18 02 16 ba 00 02 00 0a ........ 000018 4a J ACC= 0x0a 10 . B= 0x00 DPTR= 0x16ba @DPTR= 0x00 0 . 000002 16 . PSW= 0x00 CY=0 AC=0 OV=0 P=0 * 000023 02 01 1c LJMP 011c >In first line the actual register bank is dumped out. Register banks reside in internal RAM, address at the begining of the line shows start address of actual register bank selected by RS0 and RS1 bits of PSW register.
Next two lines begin with value of indirectly addressed internal RAM cells. Second line shows IRAM cell pointed by R0 while third line shows IRAM addressed by R1.
Second line displays some important registers. First one is the accumulator. Its value dumped out in hexadecimal, decimal form and then the ASCII character of its value. It is followed by value of the B register which is dumped out in hexadecimal form only. Next is DPTR register in hexadecimal and then external RAM cell which is addressed by DPTR. This is dumped out in hexadecimal, decimal and ASCII too.
In third line you find program status word in hexadecimal and then
some flag bits of PSW register. Last line is disassembled instruction
at PC.
dp
Dump out ports. This command shows actual value of ports.
$ s51 remoansi.hex ucsim 0.2.12, 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 > sopt stopit 1 > g 5 * 000023 02 01 1c LJMP 011c > dp P0 11111111 0xff 255 . P1 11111110 0xfe 254 . Pin0 11111111 0xff 255 . Pin1 11111111 0xff 255 . Port0 11111111 0xff 255 . Port1 11111110 0xfe 254 . P2 11111111 0xff 255 . P3 11111111 0xff 255 . Pin2 11111111 0xff 255 . Pin3 11111111 0xff 255 . Port2 11111111 0xff 255 . Port3 11111111 0xff 255 . >First lines on the list (labeled with Px) are value of SFRs which are internal latch registers. Second lines (labeled with Pinx) are outputs of external devices connected to port pins of the microcontroller. These values can be set by you using sp command. Third lines (labeled with Portx) show actual values can be measured on pins of the device. These values are calculated with following pseudo formula:
Portx= Px AND Pinx
All three values are displayed in binary, hexadecimal, decimal form
and then the ASCII character of the value is shown.
ds [addr...]
Print out SFR. This command can be used to get value of all or some
SFRs. If you do not specify any parameter the ds command simply
dumps out full SFR area 16 bytes per line.
$ s51 remoansi.hex ucsim 0.2.12, 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 > sopt stopit 1 > g 5 * 000023 02 01 1c LJMP 011c > ds 000080 ff 2a ba 16 00 00 00 00 55 a1 d7 fe 50 fd 00 00 .*......U...P... 000090 fe 00 00 00 00 00 00 00 7e 00 00 00 00 00 00 00 ........~....... 0000a0 ff 00 00 00 00 00 00 00 97 00 00 00 00 00 00 00 ................ 0000b0 ff 00 00 00 00 00 00 00 15 00 00 00 00 00 00 00 ................ 0000c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 0000d0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 0000e0 0a 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 0000f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ > ds p1 0x87 P1 fe 254 . 000087 00 0 . > ds p2 ip scon P2 ff 255 . IP 15 21 . SCON 7e 126 ~ >If you specify one or more parameter the ds command prints out value of registers specified by parameters. Parameter can be an address or a symbolic name of the register. Note that the simulator implements a register at all address in the address space which is not true in real microcontroller where reading of an unimplemented register gets undefined value. Value of the registers printed out in hexadecimal, decimal, and ASCII form.
Note that different type of controllers can implement different registers:
$ s51 ucsim 0.2.12, 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. > ds rcap2l > q $ s51 -t 52 ucsim 0.2.12, 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. > ds rcap2l RCAP2L 00 0 . >
$ s51 ucsim 0.2.12, 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. > db it1 0x20.3 0x43 p2.5 000088 IT1 0 000020 20.3 0 000028 28.3 0 0000a0 P2.5 1 >Value of bits are printed out one per line. The list starts direct address of the bit followed by bit name or address of the memory cell or SFR which contains the displayed bit and bit number within the byte separated by a dot. At last the value of the bit is shown. Displaying a port bit you get value of SFR latch:
> sp 1 0x0f > ss p1 0x55 000090 55 U > dp P0 11111111 0xff 255 . P1 01010101 0x55 85 U Pin0 11111111 0xff 255 . Pin1 00001111 0x0f 15 . Port0 11111111 0xff 255 . Port1 00000101 0x05 5 . P2 11111111 0xff 255 . P3 11111111 0xff 255 . Pin2 11111111 0xff 255 . Pin3 11111111 0xff 255 . Port2 11111111 0xff 255 . Port3 11111111 0xff 255 . > db p1.2 p1.3 p1.4 p1.5 p1.6 000090 P1.2 1 000090 P1.3 0 000090 P1.4 1 000090 P1.5 0 000090 P1.6 1 >
$ s51 ucsim 0.2.12, 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. > si 10 dani\040hej-ho 00000a 64 61 6e 69 20 68 65 6a 2d 68 6f dani hej-ho >Result of the command is a memory dump of area which has been modified by the command. If there is syntax error in a data parameter then remaining parameters are dropped out.
> si 20 1 2 0xi 3 4 Bad data 0xi 000014 01 02 .. >
$ s51 ucsim 0.2.12, 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. > ss p1 0 000090 00 . >
$ s51 ucsim 0.2.12, 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. > sb 0x23.5 1 > db 0x23.5 000023 23.5 1 > sb p3.3 0 > dp P0 11111111 0xff 255 . P1 11111111 0xff 255 . Pin0 11111111 0xff 255 . Pin1 11111111 0xff 255 . Port0 11111111 0xff 255 . Port1 11111111 0xff 255 . P2 11111111 0xff 255 . P3 11110111 0xf7 247 . Pin2 11111111 0xff 255 . Pin3 11111111 0xff 255 . Port2 11111111 0xff 255 . Port3 11110111 0xf7 247 . > sb tr1 0 > db tr1 000088 TR1 0 > sb tr1 1 > db tr1 000088 TR1 1 >
$ s51 ucsim 0.2.12, 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. > dp P0 11111111 0xff 255 . P1 11111111 0xff 255 . Pin0 11111111 0xff 255 . Pin1 11111111 0xff 255 . Port0 11111111 0xff 255 . Port1 11111111 0xff 255 . P2 11111111 0xff 255 . P3 11111111 0xff 255 . Pin2 11111111 0xff 255 . Pin3 11111111 0xff 255 . Port2 11111111 0xff 255 . Port3 11111111 0xff 255 . > ss p1 0x55 000090 55 U > sp 1 0x0f > dp P0 11111111 0xff 255 . P1 01010101 0x55 85 U Pin0 11111111 0xff 255 . Pin1 00001111 0x0f 15 . Port0 11111111 0xff 255 . Port1 00000101 0x05 5 . P2 11111111 0xff 255 . P3 11111111 0xff 255 . Pin2 11111111 0xff 255 . Pin3 11111111 0xff 255 . Port2 11111111 0xff 255 . Port3 11111111 0xff 255 . >
$ s51 ucsim 0.2.12, 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. > fi 11 0x34 44 > di 000000 00 00 00 00 00 00 00 00 ........ 000008 00 00 00 2c 2c 2c 2c 2c ...,,,,, 000010 2c 2c 2c 2c 2c 2c 2c 2c ,,,,,,,, 000018 2c 2c 2c 2c 2c 2c 2c 2c ,,,,,,,, 000020 2c 2c 2c 2c 2c 2c 2c 2c ,,,,,,,, 000028 2c 2c 2c 2c 2c 2c 2c 2c ,,,,,,,, 000030 2c 2c 2c 2c 2c 00 00 00 ,,,,,... 000038 00 00 00 00 00 00 00 00 ........ 000040 00 00 00 00 00 00 00 00 ........ 000048 00 00 00 00 00 00 00 00 ........ >