3 GB_registers_t
Lior Halphon edited this page 2024-12-01 01:09:32 +02:00

Definition

enum {
    GB_REGISTER_AF,
    GB_REGISTER_BC,
    GB_REGISTER_DE,
    GB_REGISTER_HL,
    GB_REGISTER_SP,
    GB_REGISTER_PC,
    GB_REGISTERS_16_BIT
};

enum {
    GB_CARRY_FLAG = 0x10,
    GB_HALF_CARRY_FLAG = 0x20,
    GB_SUBTRACT_FLAG = 0x40,
    GB_ZERO_FLAG = 0x80,
};

On Little Endian targets:

typedef union {
    uint16_t registers[GB_REGISTERS_16_BIT];
    struct {
        uint16_t af,
                 bc,
                 de,
                 hl,
                 sp,
                 pc;
    };
    struct {
        uint8_t f, a,
                c, b,
                e, d,
                l, h;
    };
} GB_registers_t;

On Big Endian targets:

typedef union {
    uint16_t registers[GB_REGISTERS_16_BIT];
    struct {
        uint16_t af,
                 bc,
                 de,
                 hl,
                 sp,
                 pc;
    };
    struct {
        uint8_t a, f,
                b, c,
                d, e,
                h, l;
    };
} GB_registers_t;

In gb.h

Description

A structure that represents the internal state of the SM83 CPU in an emulator core.

See Also