rockbox/apps/plugins/rockboy/fastmem.c
Tom Ross 2882b26a99 Major Rockboy update.
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
2007-02-06 21:41:08 +00:00

77 lines
1.2 KiB
C

#include "rockmacros.h"
#include "fastmem.h"
byte readb(int a)
{
byte *p = mbc.rmap[a>>12];
if (p) return p[a];
else return mem_read(a);
}
void writeb(int a, byte b)
{
byte *p = mbc.wmap[a>>12];
if (p) p[a] = b;
else mem_write(a, b);
}
int readw(int a)
{
if ((a+1) & 0xfff)
{
byte *p = mbc.rmap[a>>12];
if (p)
{
#ifdef ROCKBOX_LITTLE_ENDIAN
#ifndef ALLOW_UNALIGNED_IO
if (a&1) return p[a] | (p[a+1]<<8);
#endif
return *(word *)(p+a);
#else
return p[a] | (p[a+1]<<8);
#endif
}
}
return mem_read(a) | (mem_read(a+1)<<8);
}
void writew(int a, int w)
{
if ((a+1) & 0xfff)
{
byte *p = mbc.wmap[a>>12];
if (p)
{
#ifdef ROCKBOX_LITTLE_ENDIAN
#ifndef ALLOW_UNALIGNED_IO
if (a&1)
{
p[a] = w;
p[a+1] = w >> 8;
return;
}
#endif
*(word *)(p+a) = w;
return;
#else
p[a] = w;
p[a+1] = w >> 8;
return;
#endif
}
}
mem_write(a, w);
mem_write(a+1, w>>8);
}
byte readhi(int a)
{
return readb(a | 0xff00);
}
void writehi(int a, byte b)
{
writeb(a | 0xff00, b);
}