2 * Simulator of microcontrollers (go.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
37 #include "uc51cl.h" //FIXME
47 cmd_go(char *cmd, class t_uc51 *uc, class cl_sim *sim)
49 char *start_str, *stop_str;
53 bool brk_at_stop= DD_FALSE;
55 if (sim->state & SIM_GO)
57 fprintf(sim->cmd_out(),
58 "Execution is already running.\n");
61 if ((start_str= strtok(NULL, delimiters)) != NULL)
63 start= strtol(start_str, NULL, 0);
64 if ((stop_str= strtok(NULL, delimiters)) != NULL)
65 stop= strtol(stop_str, NULL, 0);
69 if (!uc->inst_at(start) &&
71 fprintf(sim->cmd_out(),
72 "Warning: maybe not instruction at 0x%06lx\n", start);
77 if (start == (t_addr)stop)
79 fprintf(sim->cmd_out(), "Addresses must be different.\n");
82 if ((b= uc->fbrk_at(stop)))
89 b= new cl_fetch_brk(uc->fbrk->make_new_nr(), stop, brkDYNAMIC, 1);
93 if (uc->fbrk_at(start))
95 //fprintf(sim->cmd_out(), "Simulation started, PC=0x%06x\n", uc->PC);
96 sim->cmd->printf("Simulation started, PC=0x%06x\n", uc->PC);
97 sim->start(sim->cmd->actual_console);
101 uc->fbrk->del_bp(stop);*/
102 /*fprintf(sim->cmd_out(), "%d\n", uc->result);
103 uc->print_disass(uc->PC);*/
109 cmd_stop(char *cmd, class t_uc51 *uc, class cl_sim *sim)
112 uc->print_disass(uc->PC, sim->cmd->actual_console);
118 dump_step(class t_uc51 *uc, class cl_sim *sim)
120 //cmd_dump_regs(NULL, uc, sim);
121 uc->print_regs(sim->cmd->actual_console);
130 cmd_step(char *cmd, class t_uc51 *uc, class cl_sim *sim)
135 if ((s= strtok(NULL, delimiters)) != NULL)
136 step= strtol(s, NULL, 0);
151 cmd_next(char *cmd, class t_uc51 *uc, class cl_sim *sim)
158 if ((s= strtok(NULL, delimiters)) != NULL)
159 step= strtol(s, NULL, 0);
162 if ((uc->dis_tbl()[uc->get_mem(MEM_ROM, uc->PC)].branch == 'a') ||
163 (uc->dis_tbl()[uc->get_mem(MEM_ROM, uc->PC)].branch == 'l'))
166 if (uc->dis_tbl()[uc->get_mem(MEM_ROM, uc->PC)].branch == 'l')
168 if (!uc->fbrk_at(next))
170 b= new cl_fetch_brk(uc->fbrk->make_new_nr(),
171 next, brkDYNAMIC, 1);
189 cmd_pc(char *cmd, class t_uc51 *uc, class cl_sim *sim)
194 if ((s= strtok(NULL, delimiters)) == NULL)
196 uc->print_disass(uc->PC, sim->cmd->actual_console);
199 pc= strtol(s, &p, 0);
203 fprintf(sim->cmd_out(), "Wrong parameter, PC unchanged.\n");
208 if (!uc->inst_at(pc) &&
210 fprintf(sim->cmd_out(),
211 "Warning: maybe not instruction at %06lx\n", pc);
213 uc->print_disass(uc->PC, sim->cmd->actual_console);
219 /* End of s51.src/go.cc */