2 * Simulator of microcontrollers (where.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
46 * Searching for a string in memory
50 where_memory(cl_mem *mem, bool cs, class cl_sim *sim)
57 if ((s= strtok(NULL, "\0")) == NULL)
59 str= (uchar *)proc_escape(s, &len);
62 for (i= 0; i < len; i++)
63 str[i]= toupper(str[i]);
65 while (start < mem->size-len)
69 for (i= 0; found && (i<len); i++)
70 found= str[i] == (cs?mem->get(start+i):toupper(mem->get(start+i)));
73 dump_memory(mem, &tmp, start+len-1, 8, sim->cmd_out(), sim);
88 cmd_where_iram(char *cmd, class cl_uc *uc, class cl_sim *sim)
90 where_memory(uc->mem(MEM_IRAM), FALSE, sim);
95 cmd_Where_iram(char *cmd, class cl_uc *uc, class cl_sim *sim)
97 where_memory(uc->mem(MEM_IRAM), TRUE, sim);
107 cmd_where_xram(char *cmd, class cl_uc *uc, class cl_sim *sim)
109 uc->eram2xram/*FIXME*/();
110 where_memory(uc->mem(MEM_XRAM), FALSE, sim);
115 cmd_Where_xram(char *cmd, class cl_uc *uc, class cl_sim *sim)
117 uc->eram2xram/*FIXME*/();
118 where_memory(uc->mem(MEM_XRAM), TRUE, sim);
128 cmd_where_code(char *cmd, class cl_uc *uc, class cl_sim *sim)
130 where_memory(uc->mem(MEM_ROM), FALSE, sim);
135 cmd_Where_code(char *cmd, class cl_uc *uc, class cl_sim *sim)
137 where_memory(uc->mem(MEM_ROM), TRUE, sim);
142 /* End of s51.src/where.cc */