Avr8bit-emulator
An emulator for the Atmel AVR 8-bit microcontroller
Loading...
Searching...
No Matches
sreg_utils.h
Go to the documentation of this file.
1
10#pragma once
11#include <stdint.h>
12#include <stdbool.h>
13
14#include "core.h"
15
23bool sreg_H_compute_bool(uint8_t Rd, uint8_t Rr);
24
31bool sreg_Z_compute_bool(uint8_t result);
32
40bool sreg_C_compute_bool(uint8_t Rd, uint8_t Rr);
41
48bool sreg_N_compute_bool(uint8_t result);
49
58bool sreg_V_compute_bool(uint8_t Rd, uint8_t Rr, uint8_t result);
59
67bool sreg_S_compute_bool(bool N, bool V);
68
76uint8_t sreg_C_compute(uint8_t Rd, uint8_t Rr);
77
84uint8_t sreg_Z_compute(uint8_t result);
85
92uint8_t sreg_N_compute(uint8_t result);
93
102uint8_t sreg_V_compute(uint8_t Rd, uint8_t Rr, uint8_t result);
103
111uint8_t sreg_S_compute(bool N, bool V);
112
120uint8_t sreg_H_compute(uint8_t Rd, uint8_t Rr);
121
132void update_sreg_arithm(struct CORE *core, uint8_t Rd, uint8_t Rr, uint8_t result);
133
142void update_sreg_logic(struct CORE *core, uint8_t result);
143
153void udpate_sreg_arithm_16bit(struct CORE *core, uint16_t Rd, uint16_t result);
154
161void update_sreg_C(struct CORE *core, bool state);
162
169void update_sreg_Z(struct CORE *core, bool state);
170
177void update_sreg_N(struct CORE *core, bool state);
178
185void update_sreg_V(struct CORE *core, bool state);
186
193void update_sreg_S(struct CORE *core, bool state);
194
201void update_sreg_H(struct CORE *core, bool state);
202
209void update_sreg_T(struct CORE *core, bool state);
210
217void update_sreg_I(struct CORE *core, bool state);
bool sreg_V_compute_bool(uint8_t Rd, uint8_t Rr, uint8_t result)
Computes the V flag as a boolean value.
Definition sreg_utils.c:19
bool sreg_N_compute_bool(uint8_t result)
Computes the N flag as a boolean value.
Definition sreg_utils.c:15
uint8_t sreg_Z_compute(uint8_t result)
Computes the Z flag as an 8-bit value.
Definition sreg_utils.c:31
bool sreg_H_compute_bool(uint8_t Rd, uint8_t Rr)
Computes the H flag as a boolean value.
Definition sreg_utils.c:3
bool sreg_C_compute_bool(uint8_t Rd, uint8_t Rr)
Computes the C flag as a boolean value.
Definition sreg_utils.c:11
void update_sreg_T(struct CORE *core, bool state)
Update the Transfer bit (T) in the status register.
Definition sreg_utils.c:99
void update_sreg_I(struct CORE *core, bool state)
Update the Interrupt flag (I) in the status register.
Definition sreg_utils.c:103
void update_sreg_arithm(struct CORE *core, uint8_t Rd, uint8_t Rr, uint8_t result)
Updates the Status Register (SREG) for arithmetic operations.
Definition sreg_utils.c:51
void update_sreg_H(struct CORE *core, bool state)
Update the Half Carry flag (H) in the status register.
Definition sreg_utils.c:95
void update_sreg_S(struct CORE *core, bool state)
Update the Sign flag (S) in the status register.
Definition sreg_utils.c:91
void update_sreg_logic(struct CORE *core, uint8_t result)
Updates the Status Register (SREG) for logical operations.
Definition sreg_utils.c:60
void udpate_sreg_arithm_16bit(struct CORE *core, uint16_t Rd, uint16_t result)
Updates the Status Register (SREG) for 16-bit arithmetic operations.
Definition sreg_utils.c:67
void update_sreg_Z(struct CORE *core, bool state)
Update the Zero flag (Z) in the status register.
Definition sreg_utils.c:79
bool sreg_Z_compute_bool(uint8_t result)
Computes the Z flag as a boolean value.
Definition sreg_utils.c:7
uint8_t sreg_V_compute(uint8_t Rd, uint8_t Rr, uint8_t result)
Computes the V flag as an 8-bit value.
Definition sreg_utils.c:39
uint8_t sreg_H_compute(uint8_t Rd, uint8_t Rr)
Computes the H flag as an 8-bit value.
Definition sreg_utils.c:47
void update_sreg_V(struct CORE *core, bool state)
Update the Overflow flag (V) in the status register.
Definition sreg_utils.c:87
void update_sreg_N(struct CORE *core, bool state)
Update the Negative flag (N) in the status register.
Definition sreg_utils.c:83
uint8_t sreg_S_compute(bool N, bool V)
Computes the S flag as an 8-bit value.
Definition sreg_utils.c:43
bool sreg_S_compute_bool(bool N, bool V)
Computes the S flag as a boolean value.
Definition sreg_utils.c:23
uint8_t sreg_N_compute(uint8_t result)
Computes the N flag as an 8-bit value.
Definition sreg_utils.c:35
void update_sreg_C(struct CORE *core, bool state)
Update the Carry flag (C) in the status register.
Definition sreg_utils.c:75
uint8_t sreg_C_compute(uint8_t Rd, uint8_t Rr)
Computes the C flag as an 8-bit value.
Definition sreg_utils.c:27
Core structure containing general purpose registers, program counter, stack pointer,...
Definition core.h:67