2 * Simulator of microcontrollers (imove.cc)
4 * Copyright (C) 2022 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
32 cl_f8::ld8_a_i(u8_t op2
)
39 cl_f8::ld8_a_m(class cl_cell8
&m
)
43 if (v
& 0x80) rF
|= flagN
;
51 cl_f8::ld8_m_a(class cl_cell8
&m
)
59 cl_f8::ld8_a_r(class cl_cell8
&r
)
61 class cl_cell8
*op1
, *op2
;
77 cl_f8::ldw_a_i(u16_t op2
)
84 cl_f8::ldw_a_m(u16_t addr
)
86 u16_t v
= rom
->read(addr
);
87 v
+= (rom
->read(addr
+1))*256;
89 if (v
& 0x8000) rF
|= flagN
;
97 cl_f8::ldw_m_a(u16_t addr
)
99 u16_t v
= acc16
->get();
101 rom
->write(addr
+1, v
>>8);
107 cl_f8::ldw_m_r(u16_t addr
, u16_t r
)
110 rom
->write(addr
+1, r
>>8);
116 cl_f8::ldw_a_r(u16_t r
)
123 cl_f8::LDW_A_SP(t_mem code
)
133 cl_f8::XCH_F_NSP(t_mem code
)
135 class cl_cell8
&c
= m_n_sp();
145 cl_f8::LDW_DSP_A(t_mem code
)
149 u16_t a
= read_addr(rom
, pa
);
151 u16_t v
= acc16
->get();
160 cl_f8::PUSH_M(t_mem code
)
162 class cl_cell8
&c
= m_mm();
169 cl_f8::PUSH_NSP(t_mem code
)
171 class cl_cell8
&c
= m_n_sp();
178 cl_f8::PUSH_A(t_mem code
)
180 push1(acc8
->get()); // TODO?
185 cl_f8::PUSH_NY(t_mem code
)
187 class cl_cell8
&c
= m_n_y();
194 cl_f8::PUSH_I(t_mem code
)
201 cl_f8::PUSHW_M(t_mem code
)
204 u16_t v
= read_addr(rom
, a
);
211 cl_f8::PUSHW_NSP(t_mem code
)
214 u16_t v
= read_addr(rom
, a
);
221 cl_f8::PUSHW_NNZ(t_mem code
)
224 u16_t v
= read_addr(rom
, a
);
231 cl_f8::PUSHW_A(t_mem code
)
233 u16_t v
= acc16
->get();
239 cl_f8::PUSHW_I(t_mem code
)
249 cl_f8::POP_A(t_mem code
)
256 cl_f8::POPW_A(t_mem code
)
263 cl_f8::XCH_A_NSP(t_mem code
)
265 class cl_cell8
&c
= m_n_sp();
275 cl_f8::XCH_A_Y(t_mem code
)
277 class cl_cell8
&c
= m_y();
287 cl_f8::XCH_A_A(t_mem code
)
289 u16_t t
= acc16
->get();
298 cl_f8::XCHW_Y_Z(t_mem code
)
300 u16_t t
= read_addr(rom
, rZ
);
302 rom
->write(rZ
, rYL
);
303 rom
->write(rZ
+1, rYH
);
310 cl_f8::XCHW_Z_NSP(t_mem code
)
313 u16_t t
= read_addr(rom
, a
);
316 rom
->write(a
+1, rZH
);
323 cl_f8::CAX(t_mem code
)
325 // if ((y) == xh) (z) = xl; else xh = (y);
326 u8_t my
= rom
->read(rY
);
341 cl_f8::CAXW(t_mem code
)
343 // if ((y) == z) (y) = x; else x = (y);
344 u16_t my
= read_addr(rom
, rY
);
349 rom
->write(rY
+1, rX
>>8);
360 cl_f8::CLR_M(t_mem code
)
362 class cl_cell8
&c
= m_mm();
369 cl_f8::CLR_NSP(t_mem code
)
371 class cl_cell8
&c
= m_n_sp();
378 cl_f8::CLR_A(t_mem code
)
385 cl_f8::CLR_NY(t_mem code
)
387 class cl_cell8
&c
= m_n_y();
394 cl_f8::CLRW_M(t_mem code
)
404 cl_f8::CLRW_NSP(t_mem code
)
414 cl_f8::CLRW_NNZ(t_mem code
)
424 cl_f8::CLRW_A(t_mem code
)
435 class cl_cell8
&c
= m_mm();
436 u8_t t
= c
.R(), a
= acc8
->get();
444 if (!mbit
) rF
|= flagZ
;
451 /* End of f8.src/imove.cc */