xor di and cpu flags

This commit is contained in:
2025-01-30 18:38:29 -07:00
parent 6a82e9fa03
commit 1bf98447a3
6 changed files with 38 additions and 9 deletions

View File

@ -11,7 +11,7 @@ typedef uint32_t u32;
typedef uint64_t u64;
#define BIT(a, n) ((a & (1 << n)) ? 1 : 0)
#define BIT_SET(a, n, on) (on ? (a) |= (1 << n) : (a) &= !(1 << n))
#define BIT_SET(a, n, on) {if(on) a |= (1 << n); else a &= !(1 << n);}
#define BETWEEN(a, b, c) ((a >= b) && (a <= c))
void delay(u32 ms);

View File

@ -28,6 +28,8 @@ typedef struct {
bool halted;
bool stepping;
bool int_master_enabled;
} cpu_context;
void cpu_init();
@ -38,4 +40,6 @@ typedef void (*IN_PROC)(cpu_context *);
IN_PROC inst_get_processor(in_type type);
#define CPU_FLAG_Z BIT(ctx->regs.f, 7)
#define CPU_FLAG_C BIT(ctx->regs.f, 4)
#define CPU_FLAG_C BIT(ctx->regs.f, 4)
u16 cpu_read_reg(reg_type rt);

View File

@ -2,6 +2,7 @@
#include <common.h>
typedef enum {
AM_IMP,
AM_R_D16,
AM_R_R,
AM_MR_R,
@ -17,7 +18,6 @@ typedef enum {
AM_HL_SPR,
AM_D16,
AM_D8,
AM_IMP,
AM_D16_R,
AM_MR_D8,
AM_MR,