Memory manipulation commands of µCsim

Every command which changes content of ROM area such as dl or set memory deletes result of code analyzer and causes to re-analyze the code.

file,load "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.

download,dl

Download command. It is same as load above but it reads information from command console which is standard input by default. This command stops read records when it detects an "END" record which is normaly the last record. This command has two equivalent forms download and dl.
$ 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
197 bytes loaded
> 

fill memory_type start end data

Fill memory region with specified data. First parameter specifies memory. Name of the memory must be used, it can be checked using info memory command which lists size and name of all available memories.

start and end parameters specify first and last address of the memory region to be filled.

data parameter specifies the data which is used to fill the memory region.

$ s51 
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.
> fill xram 12 0x12 0x56
> dump xram 0 0x20
0x0000 00 00 00 00 00 00 00 00 ........
0x0008 00 00 00 00 56 56 56 56 ....VVVV
0x0010 56 56 56 00 00 00 00 00 VVV.....
0x0018 00 00 00 00 00 00 00 00 ........
0x0020 00                      .
> 

where,Where memory_type data...

Searching for some data in memory. First parameter specifies memory. Name of the memory must be used, it can be checked using info memory command which lists size and name of all available memories.

Other parameters can be mixed list of strings (characters between " and ") and numbers. Strings can contain escape sequencies. µCsim merges all parameters together and will search for megred list of values in specified memory.

where command do case unsensitive search while Where command is for case sensitive search.

Search is done in whole memory and all matches are dumped out.

$ /s51
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.
> set mem xram 20 "Dani d ani D ani dani Dani"
0x0014 44 61 6e 69 20 64 20 61 Dani d a
0x001c 6e 69 20 44 20 61 6e 69 ni D ani
0x0024 20 64 61 6e 69 20 44 61  dani Da
0x002c 6e 69                   ni
> where xram "dani"
0x0014 44 61 6e 69             Dani
0x0025 64 61 6e 69             dani
0x002a 44 61 6e 69             Dani
> Where xram "d ani"
0x0019 64 20 61 6e 69          d ani
> 

memory

This set of commands can be used to manipulate memory system including chips, address spaces and address decoders.

Subcommands are:

memory createchip
memory createaddressspace
memory createaddressdecoder

memory createchip|cchip id size cellsize

This command creates a chip (array of storage elements). id must be a unique name which will be used to identify the chip in other commands. size is number of storage elements, cellsize is number of bits stored in one element.

memory createaddressspace|caddressspace|caddrspace|caspace|createaddrspace|createaspace id startaddr size

This command should never be used. It defines an adress space, names it as id sets its starting address and size. Simulator programs (s51, savr, etc.) define necessary address spaces for themself, so this command is not needed.

memory createaddressdecoder|caddrdecoder|caddressdecoder|cadecoder|createaddrdecoder|createadecoder addressspace begin end chip begin

Address decoder maps a part of the address space to a chip area. addressspace parameter is name of the address space, begin and end specify address range of the address space to be mapped. chip parameter is name of the memory chip and the second begin parameter is the (start of the) chip address where the area is mapped to.

Address space will be split if a "middle" are is mapped:

$ s51
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.
0> i m
Memory chips:
  0x000000-0x00ffff    65536 rom_chip (8,%02x,0x%04x)
  0x000000-0x00007f      128 iram_chip (8,%02x,0x%02x)
  0x000000-0x00ffff    65536 xram_chip (8,%02x,0x%04x)
  0x000000-0x00007f      128 sfr_chip (8,%02x,0x%02x)
Address spaces:
  0x000000-0x00ffff    65536 rom (8,%02x,0x%04x)
  0x000000-0x00007f      128 iram (8,%02x,0x%02x)
  0x000080-0x0000ff      128 sfr (8,%02x,0x%02x)
  0x000000-0x00ffff    65536 xram (8,%02x,0x%04x)
Address decoders:
 0 rom 0x0000 0xffff -> rom_chip 0x0000 activated
 0 iram 0x00 0x7f -> iram_chip 0x00 activated
 0 sfr 0x80 0xff -> sfr_chip 0x00 activated
 0 xram 0x0000 0xffff -> xram_chip 0x0000 activated
0> mem cchip myram 0x1000 8
0> mem createaddressdecoder xram 1234 2000 myram 15
0> i m
Memory chips:
  0x000000-0x00ffff    65536 rom_chip (8,%02x,0x%04x)
  0x000000-0x00007f      128 iram_chip (8,%02x,0x%02x)
  0x000000-0x00ffff    65536 xram_chip (8,%02x,0x%04x)
  0x000000-0x00007f      128 sfr_chip (8,%02x,0x%02x)
  0x000000-0x000fff     4096 myram (8,%02x,0x%03x)
Address spaces:
  0x000000-0x00ffff    65536 rom (8,%02x,0x%04x)
  0x000000-0x00007f      128 iram (8,%02x,0x%02x)
  0x000080-0x0000ff      128 sfr (8,%02x,0x%02x)
  0x000000-0x00ffff    65536 xram (8,%02x,0x%04x)
Address decoders:
 0 rom 0x0000 0xffff -> rom_chip 0x0000 activated
 0 iram 0x00 0x7f -> iram_chip 0x00 activated
 0 sfr 0x80 0xff -> sfr_chip 0x00 activated
 0 xram 0x0000 0x04d1 -> xram_chip 0x0000 activated
 1 xram 0x04d2 0x07d0 -> myram 0x00f activated
 2 xram 0x07d1 0xffff -> xram_chip 0x07d1 activated
0> 
It is easy to share chip area between address spaces:
$ s51
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.
0> mem createaddressdecoder rom 0 0xfff xram_chip 0xf000
0> i m
Memory chips:
  0x000000-0x00ffff    65536 rom_chip (8,%02x,0x%04x)
  0x000000-0x00007f      128 iram_chip (8,%02x,0x%02x)
  0x000000-0x00ffff    65536 xram_chip (8,%02x,0x%04x)
  0x000000-0x00007f      128 sfr_chip (8,%02x,0x%02x)
Address spaces:
  0x000000-0x00ffff    65536 rom (8,%02x,0x%04x)
  0x000000-0x00007f      128 iram (8,%02x,0x%02x)
  0x000080-0x0000ff      128 sfr (8,%02x,0x%02x)
  0x000000-0x00ffff    65536 xram (8,%02x,0x%04x)
Address decoders:
 0 rom 0x0000 0x0fff -> xram_chip 0xf000 activated
 1 rom 0x1000 0xffff -> rom_chip 0x1000 activated
 0 iram 0x00 0x7f -> iram_chip 0x00 activated
 0 sfr 0x80 0xff -> sfr_chip 0x00 activated
 0 xram 0x0000 0xffff -> xram_chip 0x0000 activated
0> rom[0]=0xab
171
0> xram[0xf000]
171
0>