2005-03-02 23:49:38 +00:00
|
|
|
|
|
|
|
|
2005-07-03 14:05:12 +00:00
|
|
|
#ifndef __CPU_GB_H__
|
|
|
|
#define __CPU_GB_H__
|
2005-03-02 23:49:38 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include "defs.h"
|
|
|
|
|
|
|
|
|
|
|
|
union reg
|
|
|
|
{
|
2007-02-06 21:41:08 +00:00
|
|
|
byte b[2][2];
|
|
|
|
word w[2];
|
|
|
|
un32 d; /* padding for alignment, carry */
|
2005-03-02 23:49:38 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct cpu
|
|
|
|
{
|
2005-03-03 19:44:02 +00:00
|
|
|
#ifdef DYNAREC
|
2007-02-06 21:41:08 +00:00
|
|
|
union reg a,b,c,d,e,hl,f,sp,pc;
|
2005-03-03 19:44:02 +00:00
|
|
|
#else
|
2007-02-06 21:41:08 +00:00
|
|
|
union reg pc, sp, bc, de, hl, af;
|
2005-03-03 19:44:02 +00:00
|
|
|
#endif
|
2007-02-06 21:41:08 +00:00
|
|
|
int ime, ima;
|
2007-10-16 18:16:22 +00:00
|
|
|
unsigned int speed;
|
|
|
|
unsigned int halt;
|
|
|
|
unsigned int div;
|
|
|
|
int tim;
|
2007-02-06 21:41:08 +00:00
|
|
|
int lcdc;
|
|
|
|
int snd;
|
2005-03-02 23:49:38 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
extern struct cpu cpu;
|
|
|
|
|
2005-03-03 19:44:02 +00:00
|
|
|
#ifdef DYNAREC
|
|
|
|
struct dynarec_block {
|
|
|
|
union reg address;
|
|
|
|
void *block;
|
|
|
|
int length;
|
|
|
|
struct dynarec_block *next;
|
|
|
|
};
|
|
|
|
|
|
|
|
#define HASH_SIGNIFICANT_LOWER_BITS 8
|
|
|
|
#define HASH_BITMASK ((1<<HASH_SIGNIFICANT_LOWER_BITS)-1)
|
|
|
|
|
|
|
|
extern struct dynarec_block *address_map[1<<HASH_SIGNIFICANT_LOWER_BITS];
|
|
|
|
extern int blockclen;
|
|
|
|
#endif
|
2005-03-02 23:49:38 +00:00
|
|
|
|
|
|
|
void cpu_reset(void);
|
2006-01-20 13:05:52 +00:00
|
|
|
void cpu_timers(int cnt) ICODE_ATTR;
|
2005-03-03 13:50:09 +00:00
|
|
|
int cpu_emulate(int cycles) ICODE_ATTR;
|
2005-03-02 23:49:38 +00:00
|
|
|
|
|
|
|
#endif
|