2 * Simulator of microcontrollers (bit.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 *____________________________________________________________________________
42 t_uc51::inst_orl_c_bit(uchar code)
46 addr= get_bit(bitaddr= fetch(), &event_at.ri, &event_at.rs);
48 (read(addr) & BIT_MASK(bitaddr)));
57 *____________________________________________________________________________
62 t_uc51::inst_anl_c_bit(uchar code)
66 addr= get_bit(bitaddr= fetch(), &event_at.ri, &event_at.rs);
68 (read(addr) & BIT_MASK(bitaddr)));
77 *____________________________________________________________________________
82 t_uc51::inst_mov_bit_c(uchar code)
86 addr= get_bit(bitaddr= fetch(), &event_at.wi, &event_at.ws);
88 (*addr)|= BIT_MASK(bitaddr);
90 (*addr)&= ~BIT_MASK(bitaddr);
100 *____________________________________________________________________________
105 t_uc51::inst_mov_c_bit(uchar code)
107 uchar *addr, bitaddr;
109 addr= get_bit(bitaddr= fetch(), &event_at.ri, &event_at.rs);
110 SET_C(read(addr) & BIT_MASK(bitaddr));
117 * 0xb0 2 24 ANL C,/bit
118 *____________________________________________________________________________
123 t_uc51::inst_anl_c_$bit(uchar code)
125 uchar *addr, bitaddr;
127 addr= get_bit(bitaddr= fetch(), &event_at.ri, &event_at.rs);
129 !(read(addr) & BIT_MASK(bitaddr)));
138 *____________________________________________________________________________
143 t_uc51::inst_cpl_bit(uchar code)
145 uchar *addr, bitaddr;
147 addr= get_bit(bitaddr= fetch(), &event_at.wi, &event_at.ws);
148 (*addr)^= BIT_MASK(bitaddr);
156 *____________________________________________________________________________
161 t_uc51::inst_cpl_c(uchar code)
163 sfr->set(PSW, sfr->get(PSW) ^ bmCY);
171 *____________________________________________________________________________
176 t_uc51::inst_clr_bit(uchar code)
178 uchar *addr, bitaddr;
180 addr= get_bit(bitaddr= fetch(), &event_at.wi, &event_at.ws);
181 (*addr)&= ~BIT_MASK(bitaddr);
189 *____________________________________________________________________________
194 t_uc51::inst_clr_c(uchar code)
196 sfr->set(PSW, sfr->get(PSW) & ~bmCY);
204 *____________________________________________________________________________
209 t_uc51::inst_setb_bit(uchar code)
211 uchar *addr, bitaddr;
213 addr= get_bit(bitaddr= fetch(), &event_at.wi, &event_at.ws);
214 (*addr)|= BIT_MASK(bitaddr);
222 *____________________________________________________________________________
227 t_uc51::inst_setb_c(uchar code)
229 sfr->set(PSW, sfr->get(PSW) | bmCY);
235 /* End of s51.src/bit.cc */