2 * Simulator of microcontrollers (logic.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
39 * 0x42 2 12 ORL addr,A
40 *____________________________________________________________________________
45 t_uc51::inst_orl_addr_a(uchar code)
49 addr= get_direct(fetch(), &event_at.wi, &event_at.ws);
50 (*addr)|= sfr->get(event_at.rs= ACC);
57 * 0x43 3 24 ORL addr,#data
58 *____________________________________________________________________________
63 t_uc51::inst_orl_addr_$data(uchar code)
67 addr= get_direct(fetch(), &event_at.wi, &event_at.ws);
76 * 0x44 2 12 ORL A,#data
77 *____________________________________________________________________________
82 t_uc51::inst_orl_a_$data(uchar code)
86 d= sfr->get(event_at.ws= ACC);
87 sfr->set(ACC, d|= fetch());
93 * 0x45 2 12 ORL A,addr
94 *____________________________________________________________________________
99 t_uc51::inst_orl_a_addr(uchar code)
103 addr= get_direct(fetch(), &event_at.ri, &event_at.rs);
104 d= sfr->get(event_at.ws= ACC);
105 sfr->set(ACC, d|= read(addr));
111 * 0x46-0x47 1 12 ORL A,@Ri
112 *____________________________________________________________________________
117 t_uc51::inst_orl_a_$ri(uchar code)
122 addr= get_indirect(event_at.ri= *(get_reg(code & 0x01)), &res);
123 d= sfr->get(event_at.ws= ACC);
124 sfr->set(ACC, d|= *addr);
130 * 0x48-0x4f 1 12 ORL A,Rn
131 *____________________________________________________________________________
136 t_uc51::inst_orl_a_rn(uchar code)
140 d= sfr->get(event_at.ws= ACC);
141 sfr->set(ACC, d|= *(get_reg(code & 0x07, &event_at.ri)));
147 * 0x52 2 12 ANL addr,A
148 *____________________________________________________________________________
153 t_uc51::inst_anl_addr_a(uchar code)
157 addr= get_direct(fetch(), &event_at.wi, &event_at.ws);
158 (*addr)&= sfr->get(event_at.rs= ACC);
165 * 0x53 3 24 ANL addr,#data
166 *____________________________________________________________________________
171 t_uc51::inst_anl_addr_$data(uchar code)
175 addr= get_direct(fetch(), &event_at.wi, &event_at.ws);
184 * 0x54 2 12 ANL A,#data
185 *____________________________________________________________________________
190 t_uc51::inst_anl_a_$data(uchar code)
194 d= sfr->get(event_at.ws= ACC);
195 sfr->set(ACC, d&= fetch());
201 * 0x55 2 12 ANL A,addr
202 *____________________________________________________________________________
207 t_uc51::inst_anl_a_addr(uchar code)
211 addr= get_direct(fetch(), &event_at.ri, &event_at.rs);
212 d= sfr->get(event_at.ws= ACC);
213 sfr->set(ACC, d&= read(addr));
219 * 0x56-0x57 1 12 ANL A,@Ri
220 *____________________________________________________________________________
225 t_uc51::inst_anl_a_$ri(uchar code)
230 addr= get_indirect(event_at.ri= *(get_reg(code & 0x01)), &res);
231 d= sfr->get(event_at.ws= ACC);
232 sfr->set(ACC, d&= *addr);
238 * 0x58-0x5f 1 12 ANL A,Rn
239 *____________________________________________________________________________
244 t_uc51::inst_anl_a_rn(uchar code)
248 d= sfr->get(event_at.ws= ACC);
249 sfr->set(ACC, d&= *(get_reg(code & 0x07, &event_at.ri)));
255 * 0x62 2 12 XRL addr,A
256 *____________________________________________________________________________
261 t_uc51::inst_xrl_addr_a(uchar code)
265 addr= get_direct(fetch(), &event_at.wi, &event_at.ws);
266 (*addr)^= sfr->get(event_at.rs= ACC);
273 * 0x63 3 24 XRL addr,#data
274 *____________________________________________________________________________
279 t_uc51::inst_xrl_addr_$data(uchar code)
283 addr= get_direct(fetch(), &event_at.wi, &event_at.ws);
292 * 0x64 2 12 XRL A,#data
293 *____________________________________________________________________________
298 t_uc51::inst_xrl_a_$data(uchar code)
302 d= sfr->get(event_at.ws= ACC);
303 sfr->set(ACC, d^= fetch());
309 * 0x65 2 12 XRL A,addr
310 *____________________________________________________________________________
315 t_uc51::inst_xrl_a_addr(uchar code)
319 d= sfr->get(event_at.ws= ACC);
320 sfr->set(ACC, d^= read(get_direct(fetch(),
328 * 0x66-0x67 1 12 XRL A,@Ri
329 *____________________________________________________________________________
334 t_uc51::inst_xrl_a_$ri(uchar code)
339 addr= get_indirect(event_at.ri= *(get_reg(code & 0x01)), &res);
340 d= sfr->get(event_at.ws= ACC);
341 sfr->set(ACC, d^= *addr);
347 * 0x68-0x6f 1 12 XRL A,Rn
348 *____________________________________________________________________________
353 t_uc51::inst_xrl_a_rn(uchar code)
357 d= sfr->get(event_at.ws= ACC);
358 sfr->set(ACC, d^= *(get_reg(code & 0x07, &event_at.ri)));
365 *____________________________________________________________________________
370 t_uc51::inst_cpl_a(uchar code)
372 sfr->set(event_at.ws= ACC, ~(sfr->get(ACC)));
377 /* End of s51.src/logic.cc */