Expose PC

This commit is contained in:
Lior Halphon 2021-12-30 23:53:24 +02:00
parent 52c5610528
commit bc073e3d09
1 changed files with 14 additions and 12 deletions

View File

@ -111,6 +111,7 @@ enum {
GB_REGISTER_DE, GB_REGISTER_DE,
GB_REGISTER_HL, GB_REGISTER_HL,
GB_REGISTER_SP, GB_REGISTER_SP,
GB_REGISTER_PC,
GB_REGISTERS_16_BIT /* Count */ GB_REGISTERS_16_BIT /* Count */
}; };
@ -327,22 +328,23 @@ typedef union {
uint16_t registers[GB_REGISTERS_16_BIT]; uint16_t registers[GB_REGISTERS_16_BIT];
struct { struct {
uint16_t af, uint16_t af,
bc, bc,
de, de,
hl, hl,
sp; sp,
pc;
}; };
struct { struct {
#ifdef GB_BIG_ENDIAN #ifdef GB_BIG_ENDIAN
uint8_t a, f, uint8_t a, f,
b, c, b, c,
d, e, d, e,
h, l; h, l;
#else #else
uint8_t f, a, uint8_t f, a,
c, b, c, b,
e, d, e, d,
l, h; l, h;
#endif #endif
}; };
} GB_registers_t; } GB_registers_t;
@ -370,7 +372,6 @@ struct GB_gameboy_internal_s {
GB_SECTION(core_state, GB_SECTION(core_state,
/* Registers */ /* Registers */
uint16_t pc;
union { union {
uint16_t registers[GB_REGISTERS_16_BIT]; uint16_t registers[GB_REGISTERS_16_BIT];
struct { struct {
@ -378,7 +379,8 @@ struct GB_gameboy_internal_s {
bc, bc,
de, de,
hl, hl,
sp; sp,
pc;
}; };
struct { struct {
#ifdef GB_BIG_ENDIAN #ifdef GB_BIG_ENDIAN