2 * Simulator of microcontrollers (inst.cc)
4 * Copyright (C) 2020 Drotos Daniel
6 * To contact author send email to dr.dkdb@gmail.com
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
29 #include "mos6502cl.h"
32 cl_mos6502::NOP(t_mem code
)
38 cl_mos6502::BRK(t_mem code
)
41 PC
= (PC
+1)&0xffff;//fetch();
48 cl_mos6502::RTI(t_mem code
)
52 f
= rom
->read(0x0100 + rSP
);
57 l= rom->read(0x0100 + rSP);
59 h= rom->read(0x0100 + rSP);*/
60 PC
= pop_addr();//h*256 + l;
62 class it_level
*il
= (class it_level
*)(it_levels
->top());
66 il
= (class it_level
*)(it_levels
->pop());
75 cl_mos6502::CLI(t_mem code
)
83 cl_mos6502::SEI(t_mem code
)
91 cl_mos6502::PHP(t_mem code
)
93 u8_t v
= rF
|0x20|flagB
;
94 rom
->write(0x0100 + rSP
, v
);
98 class cl_stack_push
*op
= new cl_stack_push(instPC
, v
, spbef
, rSP
);
106 cl_mos6502::CLC(t_mem code
)
114 cl_mos6502::PLP(t_mem code
)
118 u8_t v
= rom
->read(0x0100 + rSP
);
120 class cl_stack_pop
*op
= new cl_stack_pop(instPC
, v
, spbef
, rSP
);
130 cl_mos6502::SEc(t_mem code
)
138 cl_mos6502::PHA(t_mem code
)
140 rom
->write(0x0100 + rSP
, rA
);
144 class cl_stack_push
*op
= new cl_stack_push(instPC
, rA
, spbef
, rSP
);
152 cl_mos6502::PLA(t_mem code
)
156 cA
.W(rom
->read(0x0100 + rSP
));
157 class cl_stack_pop
*op
= new cl_stack_pop(instPC
, rA
, spbef
, rSP
);
160 u8_t f
= rF
& ~(flagN
|flagZ
);
162 if (rA
&0x80) f
|= flagN
;
170 cl_mos6502::CLV(t_mem code
)
178 cl_mos6502::CLD(t_mem code
)
187 cl_mos6502::SED(t_mem code
)
195 /* End of mos6502.src/inst.cc */