## Dump commands of µCsim

### dump [/format] memory_type [start [end [bytes_per_line]]]
dump bit...

The first form can be used get the contents of memory while the second form can be used to check the value of one or more bits.

> #### dump [/format] memory_name [start [end [bytes_per_line]]]

> Dump a memory region.

> The optional /format specifies how memory is to be dumped.

> /b - binary
>   Dumps raw binary data. The output MUST be redirected to a file.
> /h - hexadecimal
>   Dumps data in a tabular hexadecimal format with an accompanying table of equivalent characters to the right.
> /i - ihex
>   Dumps data in ihex format.
> /s - string
>   Dumps a single, null terminated string starting at start.
> If no format is given dump uses a "smart" mode. This will disassemble where the code analyzer has identified executable code otherwise it is similar to the hexadecimal format except that where labels (vars that name an address) are found they are shown between the address and data and where HW registers (vars that name an address AND specify the full bit range) are found that address is shown on a line of its own and the data is given as binary, character, hex, unsigned decimal and, if the high bit is set, signed decimal. Note that smart mode only applies if memory_name is an address space since vars can only be set for cells within an address space. If memory_name is a chip the output is the same as hexadecimal (/h) output.

> memory_name specifies memory. It can be the name of an address space or a chip, and can be checked using info memory command which lists size and name of all available memories.

> start and end parameters can be used to specify the first and last address of the dumped region. If end is omitted then 64 memory locations are dumped. If both start and end are omitted then the next 64 memory locations will be dumped out. Every time when dump command is used the address of the last dumped memory location is stored and next dump command automatically continues at the next address.

> bytes_per_line can be used to specify how many memory locations should be dumped out in one line. It is 8 by default.

>     $ ucsim_51
>     uCsim 0.6-pre34, 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.
>     > dump regs
>     regs[0x0]      R0         0b00001000 0x08 '.'   8
>     regs[0x1]      R1         0b01110000 0x70 'p' 112
>     regs[0x2]      R2         0b11010100 0xd4 '.' 212 (212)
>     regs[0x3]      R3         0b10110010 0xb2 '.' 178 (178)
>     regs[0x4]      R4         0b10001010 0x8a '.' 138 (138)
>     regs[0x5]      R5         0b00101001 0x29 ')'  41
>     regs[0x6]      R6         0b01010100 0x54 'T'  84
>     regs[0x7]      R7         0b01001000 0x48 'H'  72
>     > dump rom 0
>     0x0000            00 00 00 00 00 00 00 00 ........
>     0x0008            00 00 00 00 00 00 00 00 ........
>     0x0010            00 00 00 00 00 00 00 00 ........
>     0x0018            00 00 00 00 00 00 00 00 ........
>     0x0020            00 00 00 00 00 00 00 00 ........
>     0x0028            00 00 00 00 00 00 00 00 ........
>     0x0030            00 00 00 00 00 00 00 00 ........
>     0x0038            00 00 00 00 00 00 00 00 ........
>     0x0040            00 00 00 00 00 00 00 00 ........
>     0x0048            00 00 00 00 00 00 00 00 ........
>     > var label1 rom 0x0016
>     > var reg1 rom[0x0020][7:0]
>     > var reg2 rom[0x0021][7:0]
>     > dump rom 0
>     0x0000            00 00 00 00 00 00 00 00 ........
>     0x0008            00 00 00 00 00 00 00 00 ........
>     0x0010            00 00 00 00 00 00       ......
>     0x0016 label1     00 00 00 00 00 00 00 00 ........
>     0x001e            00 00                   ..
>     0x0020 reg1       0b00000000 0x00 '.'   0
>     0x0021 reg2       0b00000000 0x00 '.'   0
>     0x0022            00 00 00 00 00 00 00 00 ........
>     0x002a            00 00 00 00 00 00 00 00 ........
>     0x0032            00 00 00 00 00 00 00 00 ........
>     0x003a            00 00 00 00 00 00 00 00 ........
>     0x0042            00 00 00 00 00 00 00 00 ........
>     0x004a            00 00 00 00 00 00       ......
>     >

>     $ ucsim_51
>     ucsim 0.2.38-pre2, 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.
>     > 55470 words read from remo.hex
>     55470 words read from remo.hex
>     > run
>     Simulation started, PC=0x000000

>     Stop at 0x000515: (105) User stopped
>     F 0x000515
>     > du rom 20
>     0x0014 00 ac ff ff ff ff ff ff ........
>     0x001c ff ff ff ff ff ff ff 02 ........
>     0x0024 01 1c ff ff ff ff ff 32 .......2
>     0x002c ff ff ff ff 02 0f a7 02 ........
>     0x0034 0e 9c 02 0d d2 02 08 41 .......A
>     0x003c c0 82 c0 83 c0 d0 c0 e0 ........
>     0x0044 c0 00 a2 90 c0 d0 c2 90 ........
>     0x004c 78 18 06 30 03 4b 20 92 x..0.K .
>     0x0054 48 30 07 05 c2 07 02 00 H0......
>     0x005c 9d 30 08 05 20 93 3a c2 .0.. .:.
>     > du xram 10 20 10
>     0x000a ff 01 00 fa 01 01 40 01 01 44 ......@..D
>     0x0014 01                            .
>     > du xram
>     0x0015 00 00 00 00 00 00 00 00 ........
>     0x001d 00 10 01 00 ae 01 00 ae ........
>     0x0025 02 12 e1 00 5a 85 00 01 ....Z...
>     0x002d 00 3b 00 00 5a 85 00 ab .;..Z...
>     0x0035 1f 80 00 00 01 00 01 00 ........
>     0x003d fa 0c 02 01 00 fa 00 02 ........
>     0x0045 00 01 00 ab 00 00 00 00 ........
>     0x004d 00 00 5a 85 ff 00 01 00 ..Z.....
>     0x0055 00 00 00 94 a7 01 0c a6 ........
>     0x005d 00 6f ff 00 00 00 00 00 .o......
>     >

> #### dump bit_name...

> This command can be used to print out values of bit(s). Any form of bit address can be used as parameter:

>     0> dump AC P1.2 0x21
>     0xd6      AC:                       0b0 0x00 '.'   0
>     0x90.2                              0b-----1-- 0x01 '.'   1
>     0x24.1                              0b------0- 0x00 '.'   0
>     0>

### dch [start [stop]]

Hexadecimal dump of code memory area from address start to address stop. Default value of start address is address of following memory cell which was dumped by previous dch command. If stop parameter is not given dch command lists 10 lines 8 bytes per line.

    $ ucsim_51 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 characters of bytes dumped out in the line. If value of the memory cell is not printable than a dot is dumped out.

### dc [start [stop]]

Disassembled dump of code memory area. This command simply produces disassembled list of memory area specified by the parameters. Default value of start parameter is last address listed by previous dc command. If stop parameter is not given 20 lines are listed.

    $ ucsim_51 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
    >

### disassemble [start [offset [lines]]]

Disassemble code. This command can be used to list disassembled instructions which discovered by the code analyser. First two parameters specify the address where the list starts. First parameter is address where the command starts to search an instruction. This search goes forward. When the first instruction marked by code analyzer found the simulator skips as many instructions as you specify in second parameter. If offset is negative the simulator goes backward and skips specified number of instructions. Default value of start parameter is last address which was listed by previous dis command and default value of offset is -1. It means you can make continuous list repeating parameterless dis command.

In third parameter you can specify how many instructions you want to list. Default value is 20.

    $ ucsim_51 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
       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
    > br 0x180
    > tbr 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 asterisk (*) which means that the listed address is not marked by the code analyzer. dis lists marked instructions only so asterisk 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.

### di [start [stop]]

Hexadecimal dump of iram named address space area from address start to address stop. Default value of start address is address of following memory cell which was dumped by previous di command. If stop parameter is not given di command lists 10 lines 8 bytes per line.

    $ ucsim_51 remoansi.hex
    ucsim 0.5.0-pre3, 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
    0> set opt irq_stop 1
    0> go
    Simulation started, PC=0x000000
    Stop at 000023: (5) Interrupt
    F 000023
    0> 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 ........
    0>

### dx [start [stop]]

Hexadecimal dump of xram named address space area from address start to address stop. Default value of start address is address of following memory cell which was dumped by previous dx command. If stop parameter is not given dx command lists 10 lines 8 bytes per line.

    $ ucsim_51 remoansi.hex
    ucsim 0.5.0-pre3, 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
    0> set opt irq_stop 1
    0> go
    Simulation started, PC=0x000000
    Stop at 000023: (5) Interrupt
    F 000023
    0> 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 ..$.....
    0>

### ds [start [stop]]

Hexadecimal dump of sfr named address space area from address start to address stop. Default value of start address is address of following memory cell which was dumped by previous ds command. If stop parameter is not given ds command lists 10 lines 8 bytes per line.

    $ ucsim_51 remo.hex
    ucsim 0.5.0-pre3, 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
    0> set opt irq_stop 1
    0> go
    Simulation started, PC=0x000000
    Stop at 000023: (5) Interrupt
    F 000023
    0> ds
    0x80 ff 2a 1e 13 00 00 00 80 .*......
    0x88 d5 21 f7 fd 50 fd 00 00 .!..P...
    0x90 fe 00 00 00 00 00 00 00 ........
    0x98 7e 0a 00 00 00 00 00 00 ~.......
    0xa0 ff 00 00 00 00 00 00 00 ........
    0xa8 97 00 00 00 00 00 00 00 ........
    0xb0 ff 00 00 00 00 00 00 00 ........
    0xb8 15 00 00 00 00 00 00 00 ........
    0xc0 00 00 00 00 00 00 00 00 ........
    0xc8 00 00 00 00 00 00 00 00 ........
    0>