forked from len0rd/rockbox
1) Adapt Rockboy to smaller screens (H10, X5, and iPod Nano). 2) Add the ability to use a preset palette on color targets. Choose 'Set Palette' from the main menu. 3) Clean up the code to remove any unused code and variables. 4) Changed tabs to spaces. 5) Disable reading and writing sound when sound is disabled. 6) Disbable writing to the RTC since it is not implemented yet. 7) Minor optimizations from WAC gnuboy CE and iBoy. 8) Massive clean up of code to make it appear consistent. 9) Change all C++ style comments to C style. 10) Completely reorganize dynarec. Add fixmes to all unimplemented opcodes. Add debug writes for all opcodes. Attempt to implement a few opcodes myself. 11) Silence some warnings when built using dynarec. 12) Minor reshuffling of IRAM, may or not offer a speed increase. 13) Include fixes found in the short-lived gnuboy CVS. All in all, there's about a 10% improvement on my test roms when sound is disabled and slight improvement with sound. Especially noticable when there are few sprites on screen and less action is occurring. See FS #6567. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12216 a1c6a512-1295-4272-9138-f99709370657
68 lines
1.2 KiB
C
68 lines
1.2 KiB
C
#ifndef __MEM_H__
|
|
#define __MEM_H__
|
|
|
|
|
|
#include "defs.h"
|
|
|
|
|
|
|
|
#define MBC_NONE 0
|
|
#define MBC_MBC1 1
|
|
#define MBC_MBC2 2
|
|
#define MBC_MBC3 3
|
|
#define MBC_MBC5 5
|
|
#define MBC_RUMBLE 15
|
|
#define MBC_HUC1 0xC1
|
|
#define MBC_HUC3 0xC3
|
|
|
|
struct mbc
|
|
{
|
|
int type;
|
|
int model;
|
|
int rombank;
|
|
int rambank;
|
|
int romsize;
|
|
int ramsize;
|
|
int enableram;
|
|
int batt;
|
|
byte *rmap[0x10], *wmap[0x10];
|
|
};
|
|
|
|
struct rom
|
|
{
|
|
byte (*bank)[16384];
|
|
char name[20];
|
|
};
|
|
|
|
struct ram
|
|
{
|
|
byte hi[256];
|
|
byte ibank[8][4096];
|
|
byte (*sbank)[8192];
|
|
int loaded;
|
|
};
|
|
|
|
|
|
extern struct mbc mbc;
|
|
extern struct rom rom;
|
|
extern struct ram ram;
|
|
|
|
void mem_updatemap(void) ICODE_ATTR;
|
|
void ioreg_write(byte r, byte b) ICODE_ATTR;
|
|
void mbc_write(int a, byte b) ICODE_ATTR;
|
|
void mem_write(int a, byte b) ICODE_ATTR;
|
|
byte mem_read(int a) ICODE_ATTR;
|
|
void mbc_reset(void);
|
|
|
|
|
|
#define READB(a) ( mbc.rmap[(a)>>12] \
|
|
? mbc.rmap[(a)>>12][(a)] \
|
|
: mem_read((a)) )
|
|
#define READW(a) ( READB((a)) | ((word)READB((a)+1)<<8) )
|
|
|
|
#define WRITEB(a, b) ( mbc.wmap[(a)>>12] \
|
|
? ( mbc.wmap[(a)>>12][(a)] = (b) ) \
|
|
: ( mem_write((a), (b)), (b) ) )
|
|
#define WRITEW(a, w) ( WRITEB((a), (w)&0xFF), WRITEB((a)+1, (w)>>8) )
|
|
|
|
#endif
|