void writememfl(unsigned long addr, unsigned long val);
unsigned long readmemfl(unsigned long addr);
unsigned long *getpccache(unsigned long pc);

//#define readmeml(a)  readmemfl(a)
//#define readmemw(a)  readmemfw(a)
//#define readmemb(a)  readmemfb(a)
//#define writememl(a,v) writememfl(a,v)
//#define writememw(a,v) writememfw(a,v)
//#define writememb(a,v) writememfb(a,v)

unsigned long *ram, *rom, *ram2, *vram,*bios;
unsigned short *ramw,*romw,*ram2w,*vramw,*biosw;
unsigned char *ramb,*romb,*ram2b,*vramb,*biosb;

int readfast[256],writefast[256];
unsigned char  *readfast2b[256];
unsigned short *readfast2w[256];
unsigned long  *readfast2l[256];
unsigned long readfastm[256];

#define readmemb(a) ((readfast[(a)>>24])?readfast2b[(a)>>24][((a)&readfastm[(a)>>24])]:readmemfb(a))
#define readmemw(a) ((readfast[(a)>>24])?readfast2w[(a)>>24][((a)&readfastm[(a)>>24])>>1]:readmemfw(a))
#define readmeml(a) ((readfast[(a)>>24])?readfast2l[(a)>>24][((a)&readfastm[(a)>>24])>>2]:readmemfl(a))

#define writememb(a,v) /*if (((a)&0xF007FFC)==0x3002364) printf("Write 3002364B %02X %07X\n",v,PC);*/ if (writefast[(a)>>24]) readfast2b[(a)>>24][((a)&readfastm[(a)>>24])]=v; else writememfb(a,v)
#define writememw(a,v) /*if (((a)&0xF007FFC)==0x3005068) printf("Write 3005068W %04X %07X\n",v,PC);*/ if (writefast[(a)>>24]) readfast2w[(a)>>24][((a)&readfastm[(a)>>24])>>1]=v; else writememfw(a,v)
#define writememl(a,v) /*if (((a)&0xF007FFC)==0x3007EFC) printf("Write 3007EFCL %08X %07X\n",v,PC);*/ if (writefast[(a)>>24]) readfast2l[(a)>>24][((a)&readfastm[(a)>>24])>>2]=v; else writememfl(a,v)

int eeprompresent,srampresent,flashpresent,flashsize;

int dmasize;
