cpu: rewrite to a single switch-based dispatch
This will make it easier to experiment with direct-threading in the future.
This commit is contained in:
@@ -10,10 +10,10 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#define LR35902_FLAG_BIT_C 4
|
||||
#define LR35902_FLAG_BIT_H 5
|
||||
#define LR35902_FLAG_BIT_N 6
|
||||
#define LR35902_FLAG_BIT_Z 7
|
||||
#define CPU_F_BIT_POS_C 4
|
||||
#define CPU_F_BIT_POS_H 5
|
||||
#define CPU_F_BIT_POS_N 6
|
||||
#define CPU_F_BIT_POS_Z 7
|
||||
|
||||
#define LR35902_MAX_EVENTS 16
|
||||
|
||||
@@ -78,11 +78,20 @@ struct lr35902_state {
|
||||
uint16_t bc, de, hl, af, pc, sp;
|
||||
};
|
||||
uint8_t regs_8[NUM_LR35902_REGS_8];
|
||||
|
||||
struct {
|
||||
uint8_t b, c, d, e, h, l, a, f;
|
||||
uint8_t b, c, d, e, h, l, a, f_dummy;
|
||||
};
|
||||
};
|
||||
|
||||
/* Only two operations access the flags as a collective, PUSH
|
||||
* AF and POP AF. It's much easier to represent them as
|
||||
* individual flags and combine them when needed */
|
||||
int zf;
|
||||
int nf;
|
||||
int hf;
|
||||
int cf;
|
||||
|
||||
uint8_t stall_cycles;
|
||||
uint8_t halted;
|
||||
lr35902_mem_read_fn mem_read;
|
||||
|
||||
Reference in New Issue
Block a user