4 return ((Rd & 0x0F) + (Rr & 0x0F) > 0x0F);
12 return ((uint16_t)Rd + (uint16_t)Rr > 0xFF);
16 return (result & 0x80);
20 return ((Rd & Rr & ~result) | (~Rd & ~Rr & result));
28 return ((uint16_t)Rd + (uint16_t)Rr > 0xFF);
32 return (result == 0 ? 2 : 0);
36 return (result & 0x80 ? 4 : 0);
40 return ((Rd & Rr & ~result) | (~Rd & ~Rr & result) ? 8 : 0);
44 return (N ^ V ? 16 : 0);
48 return ((Rd & 0x0F) + (Rr & 0x0F) > 0x0F ? 32 : 0);
68 core->
sreg.
C = (!(Rd>>15) & (result>>15));
69 core->
sreg.
Z = result == 0 ? 1 : 0;
70 core->
sreg.
N = result >> 15;
71 core->
sreg.
V = (!(Rd>>15) & (result>>15));
100 core->
sreg.
T = state;
104 core->
sreg.
I = state;
bool sreg_V_compute_bool(uint8_t Rd, uint8_t Rr, uint8_t result)
Computes the V flag as a boolean value.
bool sreg_N_compute_bool(uint8_t result)
Computes the N flag as a boolean value.
uint8_t sreg_Z_compute(uint8_t result)
Computes the Z flag as an 8-bit value.
bool sreg_H_compute_bool(uint8_t Rd, uint8_t Rr)
Computes the H flag as a boolean value.
bool sreg_C_compute_bool(uint8_t Rd, uint8_t Rr)
Computes the C flag as a boolean value.
void update_sreg_T(struct CORE *core, bool state)
Update the Transfer bit (T) in the status register.
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.
void update_sreg_H(struct CORE *core, bool state)
Update the Half Carry flag (H) in the status register.
void update_sreg_S(struct CORE *core, bool state)
Update the Sign flag (S) in the status register.
void update_sreg_logic(struct CORE *core, uint8_t result)
Updates the Status Register (SREG) for logical operations.
void udpate_sreg_arithm_16bit(struct CORE *core, uint16_t Rd, uint16_t result)
Updates the Status Register (SREG) for 16-bit arithmetic operations.
void update_sreg_Z(struct CORE *core, bool state)
Update the Zero flag (Z) in the status register.
bool sreg_Z_compute_bool(uint8_t result)
Computes the Z flag as a boolean value.
uint8_t sreg_V_compute(uint8_t Rd, uint8_t Rr, uint8_t result)
Computes the V flag as an 8-bit value.
uint8_t sreg_H_compute(uint8_t Rd, uint8_t Rr)
Computes the H flag as an 8-bit value.
void update_sreg_V(struct CORE *core, bool state)
Update the Overflow flag (V) in the status register.
void update_sreg_N(struct CORE *core, bool state)
Update the Negative flag (N) in the status register.
uint8_t sreg_S_compute(bool N, bool V)
Computes the S flag as an 8-bit value.
bool sreg_S_compute_bool(bool N, bool V)
Computes the S flag as a boolean value.
uint8_t sreg_N_compute(uint8_t result)
Computes the N flag as an 8-bit value.
void update_sreg_C(struct CORE *core, bool state)
Update the Carry flag (C) in the status register.
uint8_t sreg_C_compute(uint8_t Rd, uint8_t Rr)
Computes the C flag as an 8-bit value.
Functions for manipulating the Status Register (SREG)
Core structure containing general purpose registers, program counter, stack pointer,...