2 * Simulator of microcontrollers (cmd.cc)
4 * Copyright (C) 1999,99 Drotos Daniel, Talker Bt.
6 * To contact author send email to drdani@mazsola.iit.uni-miskolc.hu
10 /* This file is part of microcontroller simulator: ucsim.
12 UCSIM is free software; you can redistribute it and/or modify
13 it under the terms of the GNU General Public License as published by
14 the Free Software Foundation; either version 2 of the License, or
15 (at your option) any later version.
17 UCSIM is distributed in the hope that it will be useful,
18 but WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 GNU General Public License for more details.
22 You should have received a copy of the GNU General Public License
23 along with UCSIM; see the file COPYING. If not, write to the Free
24 Software Foundation, 59 Temple Place - Suite 330, Boston, MA
50 /* Table is defined at the end of this file */
58 cmd_help(char *cmd, class cl_uc *uc, class cl_sim *sim)
63 while (cmd_table[i].name != NULL)
65 if (cmd_table[i].help != NULL)
66 sim->cmd->printf("%s\n", cmd_table[i].help);
69 sim->cmd->printf("----\nSet of new commands:\n");
70 for (i= 0; i < sim->cmdset->count; i++)
72 class cl_cmd *cmd= (class cl_cmd *)(sim->cmdset->at(i));
73 sim->cmd->printf("%s\n", cmd->short_help);
84 cmd_get_option(char *cmd, class cl_uc *uc, class cl_sim *sim)
90 s= strtok(NULL, delimiters);
91 for (i= 0; i < uc->options->count; i++)
93 o= (class cl_option *)(uc->options->at(i));
97 fprintf(sim->cmd_out(), "%s ", o->id);
98 o->print(sim->cmd_out());
99 fprintf(sim->cmd_out(), " %s\n", o->help);
107 * SET OPTION opt value
111 cmd_set_option(char *cmd, class cl_uc *uc, class cl_sim *sim)
117 if ((id= strtok(NULL, delimiters)) == NULL)
119 fprintf(sim->cmd_out(), "Name of option has not given.\n");
122 if ((s= strtok(NULL, delimiters)) == NULL)
124 fprintf(sim->cmd_out(), "Value has not given.\n");
127 for (i= 0; i < uc->options->count; i++)
129 o= (class cl_option *)(uc->options->at(i));
130 if (!strcmp(id, o->id))
141 * Table of commands and their names
144 struct cmd_entry cmd_table[]=
146 {"g" , cmd_go, DD_FALSE,
147 "g [start [stop]] Go"},
149 {"stop", cmd_stop, DD_FALSE,
152 {"pc", cmd_pc, DD_FALSE,
153 "pc [address] Get/set content of PC"},
155 {"s" , cmd_step, DD_TRUE,
158 {"n" , cmd_next, DD_TRUE,
161 {"bse", cmd_brk_sete, DD_FALSE,
162 "bse wi|ri|wx|rx|ws|rs|rc f|d addr [hit]\n"
163 " Set EVENT Breakpoint"},
165 {"bde", cmd_brk_dele, DD_FALSE,
166 "bde wi|ri|wx|rx|ws|rs|rc addr\n"
167 " Delete EVENT Breakpoint"},
169 {"ba", cmd_brk_delall, DD_FALSE,
170 "ba Delete all breakpoints"},
172 {"dis", cmd_disass, DD_TRUE,
173 "dis [start [offset [lines]]]\n"
174 " Disassemble code"},
176 {"dp", cmd_dump_port, DD_FALSE,
179 {"ds", cmd_dump_sfr, DD_FALSE,
180 "ds [addr...] Dump SFR"},
182 {"db", cmd_dump_bit, DD_TRUE,
183 "db addr... Dump bit"},
185 {"si", cmd_set_iram, DD_FALSE,
186 "si addr data... Set Internal RAM"},
188 {"sx", cmd_set_xram, DD_FALSE,
189 "sx addr data... Set External RAM"},
191 {"sc", cmd_set_code, DD_FALSE,
192 "sc addr data... Set code (ROM)"},
194 {"ss", cmd_set_sfr, DD_FALSE,
195 "ss addr data... Set SFR area"},
197 {"sb", cmd_set_bit, DD_FALSE,
198 "sb addr data... Set bit"},
200 {"sp", cmd_set_port, DD_FALSE,
201 "sp port data Set port pins"},
203 {"fi", cmd_fill_iram, DD_FALSE,
204 "fi start stop data Fill IRAM area with `data'"},
206 {"fx", cmd_fill_xram, DD_FALSE,
207 "fx start stop data Fill XRAM area with `data'"},
209 {"fs", cmd_fill_sfr, DD_FALSE,
210 "fs start stop data Fill SFR area with `data'"},
212 {"fc", cmd_fill_code, DD_FALSE,
213 "fc start stop data Fill ROM area with `data'"},
215 {"wi", cmd_where_iram, DD_FALSE,
216 "wi,Wi string Search for `string' in IRAM (Wi case sensitive)"},
217 {"Wi", cmd_Where_iram, DD_FALSE, NULL},
219 {"wx", cmd_where_xram, DD_FALSE,
220 "wx,Wx string Search for `string' in XRAM (Wx case sensitive)"},
221 {"Wx", cmd_Where_xram, DD_FALSE, NULL},
223 {"wc", cmd_where_code, DD_FALSE,
224 "wc,Wc string Search for `string' in ROM (Wc case sensitive)"},
225 {"Wc", cmd_Where_code, DD_FALSE, NULL},
227 {"sopt", cmd_set_option, DD_FALSE,
228 "sopt opt value Set value of option"},
230 {"gopt", cmd_get_option, DD_FALSE,
231 "gopt [opt] Get value of option(s)"},
233 {"show", cmd_show, DD_FALSE,
234 "show c|w Show licensing information"},
236 {"h" , cmd_help, DD_FALSE,
237 "h,? Help about commands"},
238 {"?" , cmd_help, DD_FALSE, NULL},
244 /* End of s51.src/cmd.cc */