2 * Simulator of microcontrollers (uc89c51r.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
33 #include "uc89c51rcl.h"
38 t_uc89c51r::t_uc89c51r(int Itype, int Itech, class cl_sim *asim):
39 t_uc51r(Itype, Itech, asim)
41 /*it_sources->add_at(4, new cl_it_src(bmEC, CCON, bmCCF4, 0x0033, false,
43 it_sources->add_at(4, new cl_it_src(bmEC, CCON, bmCCF3, 0x0033, false,
45 it_sources->add_at(4, new cl_it_src(bmEC, CCON, bmCCF2, 0x0033, false,
47 it_sources->add_at(4, new cl_it_src(bmEC, CCON, bmCCF1, 0x0033, false,
49 it_sources->add_at(4, new cl_it_src(bmEC, CCON, bmCCF0, 0x0033, false,
51 it_sources->add_at(4, new cl_it_src(bmEC, CCON, bmCF, 0x0033, false,
57 t_uc89c51r::mk_hw_elements(void)
61 t_uc51r::mk_hw_elements();
62 hws->add(h= new cl_pca(this, 0));
64 /*hws->add(h= new cl_pca(this, 1));
66 hws->add(h= new cl_pca(this, 2));
68 hws->add(h= new cl_pca(this, 3));
70 hws->add(h= new cl_pca(this, 4));
72 hws->add(h= new cl_89c51r_dummy_hw(this));
78 t_uc89c51r::reset(void)
81 sfr->set_bit1(CCAPM0, bmECOM);
82 sfr->set_bit1(CCAPM1, bmECOM);
83 sfr->set_bit1(CCAPM2, bmECOM);
84 sfr->set_bit1(CCAPM3, bmECOM);
85 sfr->set_bit1(CCAPM4, bmECOM);
87 dpl0= dph0= dpl1= dph1= 0;
92 t_uc89c51r::it_priority(uchar ie_mask)
96 l= sfr->get(IP) & ie_mask;
97 h= sfr->get(IPH) & ie_mask;
110 t_uc89c51r::pre_inst(void)
112 if (sfr->get(AUXR1) & bmDPS)
126 t_uc89c51r::post_inst(void)
128 if (sfr->get(AUXR1) & bmDPS)
138 t_uc51r::post_inst();
145 cl_89c51r_dummy_hw::cl_89c51r_dummy_hw(class cl_uc *auc):
146 cl_hw(auc, HW_DUMMY, 0, "_89c51r_dummy")
150 cl_89c51r_dummy_hw::init(void)
152 class cl_mem *sfr= uc->mem(MEM_SFR);
155 fprintf(stderr, "No SFR to register %s[%d] into\n", id_string, id);
157 //auxr= sfr->register_hw(AUXR, this, 0);
158 register_cell(sfr, AUXR, &auxr, wtd_restore);
163 cl_89c51r_dummy_hw::write(class cl_cell *cell, t_mem *val)
166 auxr->set_bit0(0x04);
170 /* End of s51.src/uc89c51r.cc */