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 sim->cmd->printf("Execution is already running.\n");
60 if ((start_str= strtok(NULL, delimiters)) != NULL)
62 start= strtol(start_str, NULL, 0);
63 if ((stop_str= strtok(NULL, delimiters)) != NULL)
64 stop= strtol(stop_str, NULL, 0);
68 if (!uc->inst_at(start) &&
70 sim->cmd->printf("Warning: maybe not instruction at 0x%06lx\n", start);
75 if (start == (t_addr)stop)
77 sim->cmd->printf("Addresses must be different.\n");
80 if ((b= uc->fbrk_at(stop)))
87 b= new cl_fetch_brk(uc->fbrk->make_new_nr(), stop, brkDYNAMIC, 1);
91 if (uc->fbrk_at(start))
93 //fprintf(sim->cmd_out(), "Simulation started, PC=0x%06x\n", uc->PC);
94 sim->cmd->printf("Simulation started, PC=0x%06x\n", uc->PC);
95 sim->start(sim->cmd->actual_console);
99 uc->fbrk->del_bp(stop);*/
100 /*fprintf(sim->cmd_out(), "%d\n", uc->result);
101 uc->print_disass(uc->PC);*/
107 cmd_stop(char *cmd, class t_uc51 *uc, class cl_sim *sim)
110 uc->print_disass(uc->PC, sim->cmd->actual_console);
116 dump_step(class t_uc51 *uc, class cl_sim *sim)
118 //cmd_dump_regs(NULL, uc, sim);
119 uc->print_regs(sim->cmd->actual_console);
128 cmd_step(char *cmd, class t_uc51 *uc, class cl_sim *sim)
133 if ((s= strtok(NULL, delimiters)) != NULL)
134 step= strtol(s, NULL, 0);
149 cmd_next(char *cmd, class t_uc51 *uc, class cl_sim *sim)
156 if ((s= strtok(NULL, delimiters)) != NULL)
157 step= strtol(s, NULL, 0);
160 if ((uc->dis_tbl()[uc->get_mem(MEM_ROM, uc->PC)].branch == 'a') ||
161 (uc->dis_tbl()[uc->get_mem(MEM_ROM, uc->PC)].branch == 'l'))
164 if (uc->dis_tbl()[uc->get_mem(MEM_ROM, uc->PC)].branch == 'l')
166 if (!uc->fbrk_at(next))
168 b= new cl_fetch_brk(uc->fbrk->make_new_nr(),
169 next, brkDYNAMIC, 1);
187 cmd_pc(char *cmd, class t_uc51 *uc, class cl_sim *sim)
192 if ((s= strtok(NULL, delimiters)) == NULL)
194 uc->print_disass(uc->PC, sim->cmd->actual_console);
197 pc= strtol(s, &p, 0);
201 sim->cmd->printf("Wrong parameter, PC unchanged.\n");
206 if (!uc->inst_at(pc) &&
208 sim->cmd->printf("Warning: maybe not instruction at %06lx\n", pc);
210 uc->print_disass(uc->PC, sim->cmd->actual_console);
216 /* End of s51.src/go.cc */