fix FS#8187 - charging breaks sleep timer. Now if the timer goes off and the player...
[Rockbox.git] / apps / plugins / rockboy / mem.h
blobd4097eff6d613b16bc8ff1a5749b89c13a9051ff
1 #ifndef __MEM_H__
2 #define __MEM_H__
4 #include "defs.h"
6 #define MBC_NONE 0
7 #define MBC_MBC1 1
8 #define MBC_MBC2 2
9 #define MBC_MBC3 4
10 #define MBC_MBC5 8
11 #define MBC_RUMBLE 16
12 #define MBC_HUC1 32
13 #define MBC_HUC3 64
14 #define MBC_RTC 128
15 #define MBC_BAT 256
17 struct mbc
19 int type;
20 int model;
21 int rombank;
22 int rambank;
23 int romsize;
24 int ramsize;
25 int enableram;
26 int batt;
27 byte *rmap[0x10], *wmap[0x10];
30 struct rom
32 byte (*bank)[16384];
33 char name[20];
36 struct ram
38 byte hi[256];
39 byte ibank[8][4096];
40 byte (*sbank)[8192];
41 int loaded;
44 extern struct mbc mbc;
45 extern struct rom rom;
46 extern struct ram ram;
48 void mem_updatemap(void) ICODE_ATTR;
49 void mem_write(int a, byte b) ICODE_ATTR;
50 byte mem_read(int a) ICODE_ATTR;
51 void mbc_reset(void);
54 #define READB(a) ( mbc.rmap[(a)>>12] \
55 ? mbc.rmap[(a)>>12][(a)] \
56 : mem_read((a)) )
57 #define READW(a) ( READB((a)) | ((word)READB((a)+1)<<8) )
59 #define WRITEB(a, b) ( mbc.wmap[(a)>>12] \
60 ? ( mbc.wmap[(a)>>12][(a)] = (b) ) \
61 : ( mem_write((a), (b)), (b) ) )
62 #define WRITEW(a, w) ( WRITEB((a), (w)&0xFF), WRITEB((a)+1, (w)>>8) )
64 #endif