configure.in: make XShm.h test compatible with modern autotools
[rofl0r-gnuboy.git] / mem.h
blob4c7b8eb50964cb62a818112c0e9883a0fd05a4b5
2 #ifndef __MEM_H__
3 #define __MEM_H__
6 #include "defs.h"
10 #define MBC_NONE 0
11 #define MBC_MBC1 1
12 #define MBC_MBC2 2
13 #define MBC_MBC3 3
14 #define MBC_MBC5 5
15 #define MBC_RUMBLE 15
16 #define MBC_HUC1 0xC1
17 #define MBC_HUC3 0xC3
19 struct mbc
21 int type;
22 int model;
23 int rombank;
24 int rambank;
25 int romsize;
26 int ramsize;
27 int enableram;
28 int batt;
29 byte *rmap[0x10], *wmap[0x10];
32 struct rom
34 byte (*bank)[16384];
35 char name[20];
38 struct ram
40 byte hi[256];
41 byte ibank[8][4096];
42 byte (*sbank)[8192];
43 int loaded;
47 extern struct mbc mbc;
48 extern struct rom rom;
49 extern struct ram ram;
55 void mem_updatemap();
56 void ioreg_write(byte r, byte b);
57 void mbc_write(int a, byte b);
58 void mem_write(int a, byte b);
59 byte mem_read(int a);
60 void mbc_reset();
64 #define READB(a) ( mbc.rmap[(a)>>12] \
65 ? mbc.rmap[(a)>>12][(a)] \
66 : mem_read((a)) )
67 #define READW(a) ( READB((a)) | ((word)READB((a)+1)<<8) )
69 #define WRITEB(a, b) ( mbc.wmap[(a)>>12] \
70 ? ( mbc.wmap[(a)>>12][(a)] = (b) ) \
71 : ( mem_write((a), (b)), (b) ) )
72 #define WRITEW(a, w) ( WRITEB((a), (w)&0xFF), WRITEB((a)+1, (w)>>8) )
77 #endif