new files of 0.5.2
[fw/sdcc] / sim / ucsim / doc / cmd_memory.html
1 <html>
2 <head>
3 <title>Memory manipulation commands of &micro;Csim</title>
4 </head>
5
6 <body bgcolor="white">
7
8 <h2>Memory manipulation commands of &micro;Csim</h2>
9
10 Every command which changes content of ROM area such as <b><a
11 href="#dl">dl</a></b> or <b><a href="cmd_set#set_memory">set
12 memory</a></b> deletes result of <a href="analyzer.html">code
13 analyzer</a> and causes to re-analyze the code.
14
15 <hr>
16
17
18 <a name="file"><h3>file,load <i>"FILE"</i></h3></a>
19
20 Loads file named FILE into the simulated code memory. File must
21 contain data in Intel HEX format.
22
23 <pre>
24 > <font color="#118811">file "../../remo.hex"</font>
25 55470 words read from ../../remo.hex
26
27 </pre>
28
29 Don't forget to enclose file name in quotes to make the parameter to
30 be a string.
31
32 <hr>
33
34
35 <a name="dl"><h3>download,dl</h3></a>
36
37 Download command. It is same as <a href="#l">load</a> above but it
38 reads information from command console which is standard input by
39 default. This command stops read records when it detects an "END"
40 record which is normaly the last record. This command has two
41 equivalent forms <b>download</b> and <b>dl</b>.
42
43 <pre>
44 $ <font color="#118811">s51 -V</font>
45 ucsim 0.2.24, Copyright (C) 1997 Daniel Drotos, Talker Bt.
46 ucsim comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
47 This is free software, and you are welcome to redistribute it
48 under certain conditions; type `show c' for details.
49 > <font color="#118811">do
50 :03000000020003F8
51 :1000030075812078207600D8FC900000AE83AF8203
52 :100013009000001200416005E4F0A380F690009F79
53 :1000230012004A9000A312004A9000A712006890A1
54 :1000330000AD12006875D0001200B50200B3EF6581
55 :10004300827003EE658322E493F8740193F97402DA
56 :1000530093FE740393F5828E83E869700122E4931F
57 :10006300F6A30880F4E493FC740193FD740293FEF9
58 :10007300740393FF740493F8740593F582888312D1
59 :100083000041700122E493A3A883A9828C838D820B
60 :10009300F0A3AC83AD828883898280E3212100B5FC
61 :1000A300212100B5000000B500B5000000B500B582
62 :0200B30080FECD
63 :1000B5007520117501AA850120750102850120228F
64 :00000001FF</font>
65 197 bytes loaded
66 > </pre>
67
68 <hr>
69
70
71 <a name="fill"><h3>fill <i>memory_type start end data</i></h3></a>
72
73 Fill memory region with specified data. First parameter specifies
74 memory. Name of the memory must be used, it can be checked using <a
75 href="cmd_general.html#info_memory">info memory</a> command which
76 lists size and name of all available memories.
77
78 <p><b>start</b> and <b>end</b> parameters specify first and last
79 address of the memory region to be filled.
80
81 <p><b>data</b> parameter specifies the data which is used to fill the
82 memory region.
83
84 <pre>
85 $ <font color="#118811">s51</font> 
86 ucsim 0.2.38-pre2, Copyright (C) 1997 Daniel Drotos, Talker Bt.
87 ucsim comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
88 This is free software, and you are welcome to redistribute it
89 under certain conditions; type `show c' for details.
90 > <font color="#118811">fill xram 12 0x12 0x56</font>
91 > <font color="#118811">dump xram 0 0x20</font>
92 0x0000 00 00 00 00 00 00 00 00 ........
93 0x0008 00 00 00 00 56 56 56 56 ....VVVV
94 0x0010 56 56 56 00 00 00 00 00 VVV.....
95 0x0018 00 00 00 00 00 00 00 00 ........
96 0x0020 00                      .
97 > </pre>
98
99
100 <hr>
101
102
103 <a name="where"><h3>where,Where <i>memory_type data...</i></h3></a>
104
105 Searching for some data in memory. First parameter specifies
106 memory. Name of the memory must be used, it can be checked using <a
107 href="cmd_general.html#info_memory">info memory</a> command which
108 lists size and name of all available memories.
109
110 <p>Other parameters can be mixed list of strings (characters between "
111 and ") and numbers. Strings can contain escape sequencies. &micro;Csim
112 merges all parameters together and will search for megred list of
113 values in specified memory.
114
115 <p><b>where</b> command do case unsensitive search while <b>Where</b>
116 command is for case sensitive search.
117
118 <p>Search is done in whole memory and all matches are dumped out.
119
120 <pre>
121 $ <font color="#118811">/s51</font>
122 ucsim 0.2.38-pre2, Copyright (C) 1997 Daniel Drotos, Talker Bt.
123 ucsim comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
124 This is free software, and you are welcome to redistribute it
125 under certain conditions; type `show c' for details.
126 > <font color="#118811">set mem xram 20 "Dani d ani D ani dani Dani"</font>
127 0x0014 44 61 6e 69 20 64 20 61 Dani d a
128 0x001c 6e 69 20 44 20 61 6e 69 ni D ani
129 0x0024 20 64 61 6e 69 20 44 61  dani Da
130 0x002c 6e 69                   ni
131 > <font color="#118811">where xram "dani"</font>
132 0x0014 44 61 6e 69             Dani
133 0x0025 64 61 6e 69             dani
134 0x002a 44 61 6e 69             Dani
135 > <font color="#118811">Where xram "d ani"</font>
136 0x0019 64 20 61 6e 69          d ani
137 > </pre>
138
139 <hr>
140
141
142 <a name="memory"><h3>memory</h3></a>
143
144 This set of commands can be used to manipulate <a
145 href="memory.html">memory system</a> including <a
146 href="memory.html#chip">chips</a>, <a
147 href="memory.html#address_space">address spaces</a> and <a
148 href="memory.html#address_decoder">address decoders</a>.
149
150 <p>Subcommands are:
151
152 <p>memory <a href="#memory_createchip">createchip</a>
153 <br>memory <a href="#memory_createaddressspace">createaddressspace</a>
154 <br>memory <a href="#memory_createaddressdecoder">createaddressdecoder</a>
155
156
157 <blockquote>
158
159 <a name="memory_createchip"><h4>memory createchip|cchip <i>id size
160 cellsize</i></h4></a>
161
162 This command creates a chip (array of storage elements). <b>id</b>
163 must be a unique name which will be used to identify the chip in other
164 commands. <b>size</b> is number of storage elements, <b>cellsize</b>
165 is number of bits stored in one element.
166
167 <hr>
168
169
170 <a name="memory_createaddressspace"><h4>memory
171 createaddressspace|caddressspace|caddrspace|caspace|createaddrspace|createaspace
172 <i>id startaddr size</i></h4></a>
173
174 This command should never be used. It defines an adress space, names
175 it as <b>id</b> sets its starting address and size. Simulator programs
176 (<b>s51</b>, <b>savr</b>, etc.) define necessary address spaces for
177 themself, so this command is not needed.
178
179 <hr>
180
181
182 <a name="memory_createaddressdecoder"><h4>memory
183 createaddressdecoder|caddrdecoder|caddressdecoder|cadecoder|createaddrdecoder|createadecoder
184 <i>addressspace begin end chip begin</i></h4></a>
185
186 Address decoder maps a part of the address space to a chip
187 area. <b>addressspace</b> parameter is name of the address space,
188 <b>begin</b> and <b>end</b> specify address range of the address space
189 to be mapped. <b>chip</b> parameter is name of the memory chip and
190 the second <b>begin</b> parameter is the (start of the) chip address
191 where the area is mapped to.
192
193 <p>Address space will be split if a "middle" are is mapped:
194
195 <pre>
196 $ <font color="#118811">s51</font>
197 uCsim 0.5.0-pre3, Copyright (C) 1997 Daniel Drotos, Talker Bt.
198 uCsim comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
199 This is free software, and you are welcome to redistribute it
200 under certain conditions; type `show c' for details.
201 0> <font color="#118811">i m</font>
202 Memory chips:
203   0x000000-0x00ffff    65536 rom_chip (8,%02x,0x%04x)
204   0x000000-0x00007f      128 iram_chip (8,%02x,0x%02x)
205   0x000000-0x00ffff    65536 xram_chip (8,%02x,0x%04x)
206   0x000000-0x00007f      128 sfr_chip (8,%02x,0x%02x)
207 Address spaces:
208   0x000000-0x00ffff    65536 rom (8,%02x,0x%04x)
209   0x000000-0x00007f      128 iram (8,%02x,0x%02x)
210   0x000080-0x0000ff      128 sfr (8,%02x,0x%02x)
211   0x000000-0x00ffff    65536 xram (8,%02x,0x%04x)
212 Address decoders:
213  0 rom 0x0000 0xffff -> rom_chip 0x0000 activated
214  0 iram 0x00 0x7f -> iram_chip 0x00 activated
215  0 sfr 0x80 0xff -> sfr_chip 0x00 activated
216  0 xram 0x0000 0xffff -> xram_chip 0x0000 activated
217 0> <font color="#118811">mem cchip myram 0x1000 8</font>
218 0> <font color="#118811">mem createaddressdecoder xram 1234 2000 myram 15</font>
219 0> <font color="#118811">i m</font>
220 Memory chips:
221   0x000000-0x00ffff    65536 rom_chip (8,%02x,0x%04x)
222   0x000000-0x00007f      128 iram_chip (8,%02x,0x%02x)
223   0x000000-0x00ffff    65536 xram_chip (8,%02x,0x%04x)
224   0x000000-0x00007f      128 sfr_chip (8,%02x,0x%02x)
225   0x000000-0x000fff     4096 myram (8,%02x,0x%03x)
226 Address spaces:
227   0x000000-0x00ffff    65536 rom (8,%02x,0x%04x)
228   0x000000-0x00007f      128 iram (8,%02x,0x%02x)
229   0x000080-0x0000ff      128 sfr (8,%02x,0x%02x)
230   0x000000-0x00ffff    65536 xram (8,%02x,0x%04x)
231 Address decoders:
232  0 rom 0x0000 0xffff -> rom_chip 0x0000 activated
233  0 iram 0x00 0x7f -> iram_chip 0x00 activated
234  0 sfr 0x80 0xff -> sfr_chip 0x00 activated
235  0 xram 0x0000 0x04d1 -> xram_chip 0x0000 activated
236  1 xram 0x04d2 0x07d0 -> myram 0x00f activated
237  2 xram 0x07d1 0xffff -> xram_chip 0x07d1 activated
238 0> 
239 </pre>
240
241 It is easy to share chip area between address spaces:
242
243 <pre>
244 $ <font color="#118811">s51</font>
245 uCsim 0.5.0-pre3, Copyright (C) 1997 Daniel Drotos, Talker Bt.
246 uCsim comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
247 This is free software, and you are welcome to redistribute it
248 under certain conditions; type `show c' for details.
249 0> <font color="#118811">mem createaddressdecoder rom 0 0xfff xram_chip 0xf000</font>
250 0> <font color="#118811">i m</font>
251 Memory chips:
252   0x000000-0x00ffff    65536 rom_chip (8,%02x,0x%04x)
253   0x000000-0x00007f      128 iram_chip (8,%02x,0x%02x)
254   0x000000-0x00ffff    65536 xram_chip (8,%02x,0x%04x)
255   0x000000-0x00007f      128 sfr_chip (8,%02x,0x%02x)
256 Address spaces:
257   0x000000-0x00ffff    65536 rom (8,%02x,0x%04x)
258   0x000000-0x00007f      128 iram (8,%02x,0x%02x)
259   0x000080-0x0000ff      128 sfr (8,%02x,0x%02x)
260   0x000000-0x00ffff    65536 xram (8,%02x,0x%04x)
261 Address decoders:
262  0 rom 0x0000 0x0fff -> xram_chip 0xf000 activated
263  1 rom 0x1000 0xffff -> rom_chip 0x1000 activated
264  0 iram 0x00 0x7f -> iram_chip 0x00 activated
265  0 sfr 0x80 0xff -> sfr_chip 0x00 activated
266  0 xram 0x0000 0xffff -> xram_chip 0x0000 activated
267 0> <font color="#118811">rom[0]=0xab</font>
268 171
269 0> <font color="#118811">xram[0xf000]</font>
270 171
271 0> 
272 </pre>
273
274
275 <hr>
276
277
278 </blockquote>
279
280 <hr>
281
282
283 </body>
284 </html>