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
38 *____________________________________________________________________________
43 cl_51core::inst_orl_c_bit(uchar code)
49 class cl_address_space *mem;
50 mem= bit2mem(bitaddr= fetch(), &a, &m);
51 SFR_SET_C(SFR_GET_C ||
60 *____________________________________________________________________________
65 cl_51core::inst_anl_c_bit(uchar code)
69 class cl_address_space *mem;
71 mem= bit2mem(fetch(), &a, &m);
72 SFR_SET_C(SFR_GET_C &&
81 *____________________________________________________________________________
86 cl_51core::inst_mov_bit_c(uchar code)
90 class cl_address_space *mem;
92 mem= bit2mem(fetch(), &a, &m);
93 d= mem->read(a, HW_PORT);
104 * 0xa2 2 12 MOV C,bit
105 *____________________________________________________________________________
110 cl_51core::inst_mov_c_bit(uchar code)
114 class cl_address_space *mem;
116 mem= bit2mem(fetch(), &a, &m);
117 SFR_SET_C(mem->read(a) & m);
123 * 0xa0 2 24 ORL C,/bit
124 *____________________________________________________________________________
129 cl_51core::inst_orl_c_Sbit(uchar code)
133 class cl_address_space *mem;
135 mem= bit2mem(fetch(), &a, &m);
136 SFR_SET_C(SFR_GET_C ||
137 !(mem->read(a) & m));
144 * 0xb0 2 24 ANL C,/bit
145 *____________________________________________________________________________
150 cl_51core::inst_anl_c_Sbit(uchar code)
154 class cl_address_space *mem;
156 mem= bit2mem(fetch(), &a, &m);
157 SFR_SET_C(SFR_GET_C &&
158 !(mem->read(a) & m));
166 *____________________________________________________________________________
171 cl_51core::inst_cpl_bit(uchar code)
175 class cl_address_space *mem;
177 mem= bit2mem(fetch(), &a, &m);
178 d= mem->read(a, HW_PORT);
186 *____________________________________________________________________________
191 cl_51core::inst_cpl_c(uchar code)
193 psw->write(psw->read() ^ bmCY);
200 *____________________________________________________________________________
205 cl_51core::inst_clr_bit(uchar code)
209 class cl_address_space *mem;
211 mem= bit2mem(fetch(), &a, &m);
212 t_mem d= mem->read(a, HW_PORT);
220 *____________________________________________________________________________
225 cl_51core::inst_clr_c(uchar code)
227 psw->write(psw->read() & ~bmCY);
234 *____________________________________________________________________________
239 cl_51core::inst_setb_bit(uchar code)
243 class cl_address_space *mem;
245 mem= bit2mem(fetch(), &a, &m);
246 d= mem->read(a, HW_PORT);
254 *____________________________________________________________________________
259 cl_51core::inst_setb_c(uchar code)
261 psw->write(psw->read() | bmCY);
266 /* End of s51.src/bit.cc */