9 core->
PC = core->
PC + k + 1;
21 core->
PC = core->
gp.
R[30] << 8 | core->
gp.
R[31];
46 sram->
mem[core->
SP] = core->
PC + 1;
47 core->
SP = core->
SP - 2;
48 core->
PC = core->
PC + k + 1;
61 sram->
mem[core->
SP] = core->
PC + 1;
62 core->
SP = core->
SP - 2;
63 core->
PC = core->
gp.
Z;
80 core->
SP = core->
SP + 1;
81 core->
PC = sram->
mem[core->
SP] << 8 | sram->
mem[core->
SP + 1];
95 core->
SP = core->
SP + 1;
96 core->
PC = sram->
mem[core->
SP] << 8 | sram->
mem[core->
SP + 1];
102void cpse(uint8_t d, uint8_t r,
struct CORE *core) {
108 if (core->
gp.
R[d] == core->
gp.
R[r]) {
109 core->
PC = core->
PC + 2;
113 core->
PC = core->
PC + 1;
120void cp(uint8_t d, uint8_t r,
struct CORE *core) {
126 uint8_t result = core->
gp.
R[d] - core->
gp.
R[r];
132void cpc(uint8_t d, uint8_t r,
struct CORE *core) {
138 uint8_t result = core->
gp.
R[d] - core->
gp.
R[r] - core->
sreg.
C;
144void cpi(uint8_t d, uint8_t K,
struct CORE *core) {
150 uint8_t result = core->
gp.
R[d] - K;
156void sbrc(uint8_t r, uint8_t b,
struct CORE *core) {
162 if ((core->
gp.
R[r] & (1 << b)) == 0) {
163 core->
PC = core->
PC + 2;
167 core->
PC = core->
PC + 1;
174void sbrs(uint8_t r, uint8_t b,
struct CORE *core) {
180 if ((core->
gp.
R[r] & (1 << b)) == 1) {
181 core->
PC = core->
PC + 2;
185 core->
PC = core->
PC + 1;
199 if ((data_space->
io_reg[A] & (1 << b)) == 0) {
200 core->
PC = core->
PC + 2;
204 core->
PC = core->
PC + 1;
218 if ((data_space->
io_reg[A] & (1 << b)) == 1) {
219 core->
PC = core->
PC + 2;
223 core->
PC = core->
PC + 1;
230void brbs(uint8_t s, uint8_t k,
struct CORE *core) {
236 if ((core->
sreg.
sreg & (1 << s)) == 1) {
237 core->
PC = core->
PC + k + 1;
240 core->
PC = core->
PC + 1;
247void brbc(uint8_t s, uint8_t k,
struct CORE *core) {
253 if ((core->
sreg.
sreg & (1 << s)) == 0) {
254 core->
PC = core->
PC + k + 1;
257 core->
PC = core->
PC + 1;
270 if (core->
sreg.
Z == 1) {
271 core->
PC = core->
PC + k + 1;
274 core->
PC = core->
PC + 1;
287 if (core->
sreg.
Z == 0) {
288 core->
PC = core->
PC + k + 1;
291 core->
PC = core->
PC + 1;
304 if (core->
sreg.
C == 1) {
305 core->
PC = core->
PC + k + 1;
308 core->
PC = core->
PC + 1;
321 if (core->
sreg.
C == 0) {
322 core->
PC = core->
PC + k + 1;
325 core->
PC = core->
PC + 1;
338 if (core->
sreg.
C == 1) {
339 core->
PC = core->
PC + k + 1;
342 core->
PC = core->
PC + 1;
355 if (core->
sreg.
C == 0) {
356 core->
PC = core->
PC + k + 1;
359 core->
PC = core->
PC + 1;
372 if (core->
sreg.
N == 1) {
373 core->
PC = core->
PC + k + 1;
376 core->
PC = core->
PC + 1;
389 if (core->
sreg.
N == 0) {
390 core->
PC = core->
PC + k + 1;
393 core->
PC = core->
PC + 1;
407 core->
PC = core->
PC + k + 1;
410 core->
PC = core->
PC + 1;
424 core->
PC = core->
PC + k + 1;
427 core->
PC = core->
PC + 1;
440 if (core->
sreg.
H == 1) {
441 core->
PC = core->
PC + k + 1;
444 core->
PC = core->
PC + 1;
457 if (core->
sreg.
H == 0) {
458 core->
PC = core->
PC + k + 1;
461 core->
PC = core->
PC + 1;
474 if (core->
sreg.
T == 1) {
475 core->
PC = core->
PC + k + 1;
478 core->
PC = core->
PC + 1;
491 if (core->
sreg.
T == 0) {
492 core->
PC = core->
PC + k + 1;
495 core->
PC = core->
PC + 1;
508 if (core->
sreg.
V == 1) {
509 core->
PC = core->
PC + k + 1;
512 core->
PC = core->
PC + 1;
525 if (core->
sreg.
V == 0) {
526 core->
PC = core->
PC + k + 1;
529 core->
PC = core->
PC + 1;
542 if (core->
sreg.
I == 1) {
543 core->
PC = core->
PC + k + 1;
546 core->
PC = core->
PC + 1;
559 if (core->
sreg.
I == 0) {
560 core->
PC = core->
PC + k + 1;
563 core->
PC = core->
PC + 1;
void brsh(uint8_t k, struct CORE *core)
Branch if same or higher.
void sbis(uint8_t A, uint8_t b, struct CORE *core, union DATA_SPACE *data_space)
Skip if bit in I/O register is set.
void brbs(uint8_t s, uint8_t k, struct CORE *core)
Branch if status flag is set.
void ret(struct CORE *core, struct SRAM *sram)
Return from a subroutine.
void brvc(uint8_t k, struct CORE *core)
Branch if overflow cleared.
void brbc(uint8_t s, uint8_t k, struct CORE *core)
Branch if status flag is cleared.
void breq(uint8_t k, struct CORE *core)
Branch if equal.
void brts(uint8_t k, struct CORE *core)
Branch if T flag set.
void brlt(uint8_t k, struct CORE *core)
Branch if less than.
void brie(uint8_t k, struct CORE *core)
Branch if interrupts enabled.
void brvs(uint8_t k, struct CORE *core)
Branch if overflow set.
void brhc(uint8_t k, struct CORE *core)
Branch if half carry cleared.
void jmp(uint32_t k, struct CORE *core)
Perform an absolute jump.
void brge(uint8_t k, struct CORE *core)
Branch if greater or equal.
void brid(uint8_t k, struct CORE *core)
Branch if interrupts disabled.
void brtc(uint8_t k, struct CORE *core)
Branch if T flag cleared.
void brlo(uint8_t k, struct CORE *core)
Branch if lower.
void brne(uint8_t k, struct CORE *core)
Branch if not equal.
void brcc(uint8_t k, struct CORE *core)
Branch if carry cleared.
void cpc(uint8_t d, uint8_t r, struct CORE *core)
Compare two registers with carry.
void brcs(uint8_t k, struct CORE *core)
Branch if carry set.
void reti(struct CORE *core, struct SRAM *sram)
Return from an interrupt.
void cp(uint8_t d, uint8_t r, struct CORE *core)
Compare two registers.
void icall(struct CORE *core, struct SRAM *sram)
Perform an indirect call to a subroutine.
void cpse(uint8_t d, uint8_t r, struct CORE *core)
Compare and skip if equal.
void cpi(uint8_t d, uint8_t K, struct CORE *core)
Compare register with an immediate value.
void brpl(uint8_t k, struct CORE *core)
Branch if plus.
void brhs(uint8_t k, struct CORE *core)
Branch if half carry set.
void sbrc(uint8_t r, uint8_t b, struct CORE *core)
Skip if bit in register is cleared.
void rjmp(uint8_t k, struct CORE *core)
Perform a relative jump.
void sbrs(uint8_t r, uint8_t b, struct CORE *core)
Skip if bit in register is set.
void sbic(uint8_t A, uint8_t b, struct CORE *core, union DATA_SPACE *data_space)
Skip if bit in I/O register is cleared.
void brmi(uint8_t k, struct CORE *core)
Branch if minus.
void ijmp(struct CORE *core)
Perform an indirect jump.
void rcall(uint8_t k, struct CORE *core, struct SRAM *sram)
Perform a relative call to a subroutine.
Branching and jumps instructions.
void update_sreg_I(struct CORE *core, bool state)
Update the Interrupt flag (I) in the status register.
void update_sreg_arithm(struct CORE *core, uint8_t Rd, uint8_t Rr, uint8_t result)
Updates the Status Register (SREG) for arithmetic operations.
Core structure containing general purpose registers, program counter, stack pointer,...
Represents the data space in the AVR emulator.