Avr8bit-emulator
An emulator for the Atmel AVR 8-bit microcontroller
|
#include "sreg_utils.h"
Go to the source code of this file.
Functions | |
bool | sreg_H_compute_bool (uint8_t Rd, uint8_t Rr) |
Computes the H flag as a boolean value. | |
bool | sreg_Z_compute_bool (uint8_t result) |
Computes the Z flag as a boolean value. | |
bool | sreg_C_compute_bool (uint8_t Rd, uint8_t Rr) |
Computes the C flag as a boolean value. | |
bool | sreg_N_compute_bool (uint8_t result) |
Computes the N flag as a boolean value. | |
bool | sreg_V_compute_bool (uint8_t Rd, uint8_t Rr, uint8_t result) |
Computes the V flag as a boolean value. | |
bool | sreg_S_compute_bool (bool N, bool V) |
Computes the S flag as a boolean value. | |
uint8_t | sreg_C_compute (uint8_t Rd, uint8_t Rr) |
Computes the C flag as an 8-bit value. | |
uint8_t | sreg_Z_compute (uint8_t result) |
Computes the Z flag as an 8-bit value. | |
uint8_t | sreg_N_compute (uint8_t result) |
Computes the N flag as an 8-bit 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_S_compute (bool N, bool V) |
Computes the S 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_arithm (struct CORE *core, uint8_t Rd, uint8_t Rr, uint8_t result) |
Updates the Status Register (SREG) for arithmetic operations. | |
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_C (struct CORE *core, bool state) |
Update the Carry flag (C) in the status register. | |
void | update_sreg_Z (struct CORE *core, bool state) |
Update the Zero flag (Z) in the status register. | |
void | update_sreg_N (struct CORE *core, bool state) |
Update the Negative flag (N) in the status register. | |
void | update_sreg_V (struct CORE *core, bool state) |
Update the Overflow flag (V) 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_H (struct CORE *core, bool state) |
Update the Half Carry flag (H) in the status register. | |
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. | |
uint8_t sreg_C_compute | ( | uint8_t | Rd, |
uint8_t | Rr | ||
) |
Computes the C flag as an 8-bit value.
Rd | The value of the destination register. |
Rr | The value of the source register. |
Definition at line 27 of file sreg_utils.c.
Referenced by update_sreg_arithm().
bool sreg_C_compute_bool | ( | uint8_t | Rd, |
uint8_t | Rr | ||
) |
Computes the C flag as a boolean value.
Rd | The value of the destination register. |
Rr | The value of the source register. |
Definition at line 11 of file sreg_utils.c.
uint8_t sreg_H_compute | ( | uint8_t | Rd, |
uint8_t | Rr | ||
) |
Computes the H flag as an 8-bit value.
Rd | The value of the destination register. |
Rr | The value of the source register. |
Definition at line 47 of file sreg_utils.c.
Referenced by update_sreg_arithm().
bool sreg_H_compute_bool | ( | uint8_t | Rd, |
uint8_t | Rr | ||
) |
Computes the H flag as a boolean value.
Rd | The value of the destination register. |
Rr | The value of the source register. |
Definition at line 3 of file sreg_utils.c.
uint8_t sreg_N_compute | ( | uint8_t | result | ) |
Computes the N flag as an 8-bit value.
result | The result of the operation. |
Definition at line 35 of file sreg_utils.c.
Referenced by update_sreg_arithm(), and update_sreg_logic().
bool sreg_N_compute_bool | ( | uint8_t | result | ) |
Computes the N flag as a boolean value.
result | The result of the operation. |
Definition at line 15 of file sreg_utils.c.
uint8_t sreg_S_compute | ( | bool | N, |
bool | V | ||
) |
Computes the S flag as an 8-bit value.
N | The value of the N flag. |
V | The value of the V flag. |
Definition at line 43 of file sreg_utils.c.
Referenced by udpate_sreg_arithm_16bit(), update_sreg_arithm(), and update_sreg_logic().
bool sreg_S_compute_bool | ( | bool | N, |
bool | V | ||
) |
uint8_t sreg_V_compute | ( | uint8_t | Rd, |
uint8_t | Rr, | ||
uint8_t | result | ||
) |
Computes the V flag as an 8-bit value.
Rd | The value of the destination register. |
Rr | The value of the source register. |
result | The result of the operation. |
Definition at line 39 of file sreg_utils.c.
Referenced by update_sreg_arithm().
bool sreg_V_compute_bool | ( | uint8_t | Rd, |
uint8_t | Rr, | ||
uint8_t | result | ||
) |
Computes the V flag as a boolean value.
Rd | The value of the destination register. |
Rr | The value of the source register. |
result | The result of the operation. |
Definition at line 19 of file sreg_utils.c.
uint8_t sreg_Z_compute | ( | uint8_t | result | ) |
Computes the Z flag as an 8-bit value.
result | The result of the operation. |
Definition at line 31 of file sreg_utils.c.
Referenced by update_sreg_arithm(), and update_sreg_logic().
bool sreg_Z_compute_bool | ( | uint8_t | result | ) |
void udpate_sreg_arithm_16bit | ( | struct CORE * | core, |
uint16_t | Rd, | ||
uint16_t | result | ||
) |
Updates the Status Register (SREG) for 16-bit arithmetic operations.
This function updates the SREG based on the result of a 16-bit arithmetic operation.
core | Pointer to the CORE structure. |
Rd | The destination register value. |
result | The result of the 16-bit arithmetic operation. |
Definition at line 67 of file sreg_utils.c.
References SREG::C, SREG::N, SREG::S, CORE::sreg, sreg_S_compute(), SREG::V, and SREG::Z.
void update_sreg_arithm | ( | struct CORE * | core, |
uint8_t | Rd, | ||
uint8_t | Rr, | ||
uint8_t | result | ||
) |
Updates the Status Register (SREG) for arithmetic operations.
This function updates the SREG based on the result of an arithmetic operation.
core | Pointer to the CORE structure. |
Rd | The destination register value. |
Rr | The source register value. |
result | The result of the arithmetic operation. |
Definition at line 51 of file sreg_utils.c.
References SREG::C, SREG::H, SREG::N, SREG::S, CORE::sreg, sreg_C_compute(), sreg_H_compute(), sreg_N_compute(), sreg_S_compute(), sreg_V_compute(), sreg_Z_compute(), SREG::V, and SREG::Z.
Referenced by adc(), add(), cp(), cpc(), cpi(), sbc(), sbci(), sub(), and subi().
void update_sreg_C | ( | struct CORE * | core, |
bool | state | ||
) |
Update the Carry flag (C) in the status register.
core | Pointer to the CORE structure. |
state | Boolean state to set the Carry flag. |
Definition at line 75 of file sreg_utils.c.
References SREG::C, and CORE::sreg.
Referenced by com().
void update_sreg_H | ( | struct CORE * | core, |
bool | state | ||
) |
Update the Half Carry flag (H) in the status register.
core | Pointer to the CORE structure. |
state | Boolean state to set the Half Carry flag. |
Definition at line 95 of file sreg_utils.c.
References SREG::H, and CORE::sreg.
void update_sreg_I | ( | struct CORE * | core, |
bool | state | ||
) |
Update the Interrupt flag (I) in the status register.
core | Pointer to the CORE structure. |
state | Boolean state to set the Interrupt flag. |
Definition at line 103 of file sreg_utils.c.
References SREG::I, and CORE::sreg.
Referenced by reti().
void update_sreg_logic | ( | struct CORE * | core, |
uint8_t | result | ||
) |
Updates the Status Register (SREG) for logical operations.
This function updates the SREG based on the result of a logical operation.
core | Pointer to the CORE structure. |
result | The result of the logical operation. |
Definition at line 60 of file sreg_utils.c.
References SREG::N, SREG::S, CORE::sreg, sreg_N_compute(), sreg_S_compute(), sreg_Z_compute(), SREG::V, and SREG::Z.
void update_sreg_N | ( | struct CORE * | core, |
bool | state | ||
) |
Update the Negative flag (N) in the status register.
core | Pointer to the CORE structure. |
state | Boolean state to set the Negative flag. |
Definition at line 83 of file sreg_utils.c.
References SREG::N, and CORE::sreg.
void update_sreg_S | ( | struct CORE * | core, |
bool | state | ||
) |
Update the Sign flag (S) in the status register.
core | Pointer to the CORE structure. |
state | Boolean state to set the Sign flag. |
Definition at line 91 of file sreg_utils.c.
References SREG::S, and CORE::sreg.
void update_sreg_T | ( | struct CORE * | core, |
bool | state | ||
) |
Update the Transfer bit (T) in the status register.
core | Pointer to the CORE structure. |
state | Boolean state to set the Transfer bit. |
Definition at line 99 of file sreg_utils.c.
References CORE::sreg, and SREG::T.
void update_sreg_V | ( | struct CORE * | core, |
bool | state | ||
) |
Update the Overflow flag (V) in the status register.
core | Pointer to the CORE structure. |
state | Boolean state to set the Overflow flag. |
Definition at line 87 of file sreg_utils.c.
References CORE::sreg, and SREG::V.
void update_sreg_Z | ( | struct CORE * | core, |
bool | state | ||
) |
Update the Zero flag (Z) in the status register.
core | Pointer to the CORE structure. |
state | Boolean state to set the Zero flag. |
Definition at line 79 of file sreg_utils.c.
References CORE::sreg, and SREG::Z.