--- /dev/null
+@ vim:filetype=armasm
+
+
+.global clut_line @ void *dest, void *src, unsigned short *pal, int pixels_mask
+
+clut_line:
+ stmfd sp!, {r4-r11,lr}
+
+ and lr, r3, #0xff0000
+ mov lr, lr, lsr #15 @ mask
+ mov r3, r3, lsr #3
+ and r3, r3, #0xff @ counter
+ add r11,r0, #800*2
+
+clut_line_loop:
+ ldmia r1!, {r10,r12}
+
+ and r4, lr, r10, lsl #1
+ ldrh r4, [r2, r4]
+ and r5, lr, r10, lsr #7
+ ldrh r5, [r2, r5]
+ orr r4, r4, r4, lsl #16
+
+ and r6, lr, r10, lsr #15
+ ldrh r6, [r2, r6]
+ orr r5, r5, r5, lsl #16
+
+ and r7, lr, r10, lsr #23
+ ldrh r7, [r2, r7]
+ orr r6, r6, r6, lsl #16
+
+ and r8, lr, r12, lsl #1
+ ldrh r8, [r2, r8]
+ orr r7, r7, r7, lsl #16
+
+ and r9, lr, r12, lsr #7
+ ldrh r9, [r2, r9]
+ orr r8, r8, r8, lsl #16
+
+ and r10,lr, r12, lsr #15
+ ldrh r10,[r2, r10]
+ orr r9, r9, r9, lsl #16
+
+ and r12,lr, r12, lsr #23
+ ldrh r12,[r2, r12]
+ orr r10,r10,r10, lsl #16
+
+ subs r3, r3, #1
+ orr r12,r12,r12, lsl #16
+
+ stmia r0!, {r4-r10,r12}
+ stmia r11!,{r4-r10,r12}
+ bne clut_line_loop
+
+ ldmfd sp!, {r4-r11,pc}
+
-// (c) Copyright 2006-2007 notaz, All rights reserved.\r
+// (c) Copyright 2006-2008 notaz, All rights reserved.\r
// Free for non-commercial use.\r
\r
// For commercial use, separate licencing terms must be obtained.\r
#include "../common/emu.h"\r
#include "../common/config.h"\r
#include "../common/common.h"\r
+#include "asm_utils.h"\r
\r
#include <Pico/PicoInt.h>\r
#include <Pico/Patch.h>\r
#include <zlib/zlib.h>\r
\r
//#define PFRAMES\r
+#define BENCHMARK\r
+//#define USE_320_SCREEN 1\r
\r
#ifdef BENCHMARK\r
#define OSD_FPS_X (800-200)\r
{\r
memset(&defaultConfig, 0, sizeof(defaultConfig));\r
defaultConfig.EmuOpt = 0x9f | 0x00700; // | <- ram_tmng, confirm_save, cd_leds\r
- defaultConfig.s_PicoOpt = 0x0f | POPT_EXT_FM|POPT_EN_MCD_PCM|POPT_EN_MCD_CDDA|POPT_EN_SVP_DRC|POPT_ACC_SPRITES|POPT_EN_MCD_GFX;\r
+ defaultConfig.s_PicoOpt = 0x0f | POPT_EXT_FM|POPT_EN_MCD_PCM|POPT_EN_MCD_CDDA|POPT_EN_SVP_DRC;\r
+ defaultConfig.s_PicoOpt |= POPT_ACC_SPRITES|POPT_EN_MCD_GFX;\r
+ defaultConfig.s_PicoOpt &= ~POPT_EN_SVP_DRC; // crashes :(\r
defaultConfig.s_PsndRate = 44100;\r
defaultConfig.s_PicoRegion = 0; // auto\r
defaultConfig.s_PicoAutoRgnOrder = 0x184; // US, EU, JP\r
defaultConfig.s_PicoCDBuffers = 0;\r
- defaultConfig.Frameskip = 0; // auto\r
+ defaultConfig.Frameskip = 0;\r
defaultConfig.CPUclock = 200;\r
defaultConfig.volume = 50;\r
defaultConfig.scaling = 0;\r
\r
for (i = 0; i < len; i++)\r
{\r
- for (l=0;l<16;l+=2)\r
+ for (l=0;l<16;)\r
{\r
unsigned char fd = fontdata8x8[((text[i])*8)+l/2];\r
- int u = l+1;\r
- if(fd&0x80) screen[l*SCREEN_WIDTH/2+0]=screen[u*SCREEN_WIDTH/2+0]=0xffffffff;\r
- if(fd&0x40) screen[l*SCREEN_WIDTH/2+1]=screen[u*SCREEN_WIDTH/2+1]=0xffffffff;\r
- if(fd&0x20) screen[l*SCREEN_WIDTH/2+2]=screen[u*SCREEN_WIDTH/2+2]=0xffffffff;\r
- if(fd&0x10) screen[l*SCREEN_WIDTH/2+3]=screen[u*SCREEN_WIDTH/2+3]=0xffffffff;\r
- if(fd&0x08) screen[l*SCREEN_WIDTH/2+4]=screen[u*SCREEN_WIDTH/2+4]=0xffffffff;\r
- if(fd&0x04) screen[l*SCREEN_WIDTH/2+5]=screen[u*SCREEN_WIDTH/2+5]=0xffffffff;\r
- if(fd&0x02) screen[l*SCREEN_WIDTH/2+6]=screen[u*SCREEN_WIDTH/2+6]=0xffffffff;\r
- if(fd&0x01) screen[l*SCREEN_WIDTH/2+7]=screen[u*SCREEN_WIDTH/2+7]=0xffffffff;\r
+ unsigned int *d = &screen[l*SCREEN_WIDTH/2];\r
+ if (fd&0x80) d[0]=0xffffffff;\r
+ if (fd&0x40) d[1]=0xffffffff;\r
+ if (fd&0x20) d[2]=0xffffffff;\r
+ if (fd&0x10) d[3]=0xffffffff;\r
+ if (fd&0x08) d[4]=0xffffffff;\r
+ if (fd&0x04) d[5]=0xffffffff;\r
+ if (fd&0x02) d[6]=0xffffffff;\r
+ if (fd&0x01) d[7]=0xffffffff;\r
+ l++; d = &screen[l*SCREEN_WIDTH/2];\r
+ if (fd&0x80) d[0]=0xffffffff;\r
+ if (fd&0x40) d[1]=0xffffffff;\r
+ if (fd&0x20) d[2]=0xffffffff;\r
+ if (fd&0x10) d[3]=0xffffffff;\r
+ if (fd&0x08) d[4]=0xffffffff;\r
+ if (fd&0x04) d[5]=0xffffffff;\r
+ if (fd&0x02) d[6]=0xffffffff;\r
+ if (fd&0x01) d[7]=0xffffffff;\r
+ l++;\r
}\r
screen += 8;\r
}\r
len++;\r
for (h = 0; h < 16; h++) {\r
p = (int *) ((unsigned short *) gp2x_screen+x+SCREEN_WIDTH*(y+h));\r
- for (i = len; i; i--, p++) *p = (*p>>2)&0x39e7;\r
+ for (i = len; i; i--, p++) *p = 0;//(*p>>2)&0x39e7;\r
}\r
textOut16(x, y, text);\r
}\r
p[640] ^= 0xffff;\r
}\r
\r
+#ifdef USE_320_SCREEN\r
+\r
+static int EmuScanBegin16(unsigned int num)\r
+{\r
+ if (!(Pico.video.reg[1]&8)) num += 8;\r
+ DrawLineDest = (unsigned short *)gp2x_screen + num*800 + 800/2 - 320/2;\r
+ //int w = (Pico.video.reg[12]&1) ? 320 : 256;\r
+ //DrawLineDest = (unsigned short *)gp2x_screen + num*w;\r
+\r
+ return 0;\r
+}\r
+\r
+#else // USE_320_SCREEN\r
+\r
static int EmuScanEnd16(unsigned int num)\r
{\r
unsigned char *ps=HighCol+8;\r
if (Pico.video.reg[12]&1) {\r
len = 320;\r
} else {\r
- pd+=32;\r
+ pd += 32*2;\r
len = 256;\r
}\r
\r
if (!sh && (rendstatus & PDRAW_ACC_SPRITES))\r
mask=0x3f; // accurate sprites, upper bits are priority stuff\r
\r
-\r
+#if 1\r
+ clut_line(pd, ps, pal, (mask<<16) | len);\r
+#else\r
for (; len > 0; len--)\r
{\r
unsigned int p = pal[*ps++ & mask];\r
*(unsigned int *)(&pd[800]) = p;\r
pd += 2;\r
}\r
+#endif\r
\r
return 0;\r
}\r
\r
+#endif // USE_320_SCREEN\r
+\r
static int EmuScanBegin8(unsigned int num)\r
{\r
if (!(Pico.video.reg[1]&8)) num += 8;\r
if (currentConfig.scaling == 2 && !(Pico.video.reg[1]&8)) h -= 16;\r
if (notice) osd_text(4, h, notice);\r
if (emu_opt & 2)\r
- osd_text(osd_fps_x+24*2, h-8, fps);\r
+ osd_text(osd_fps_x, h, fps);\r
}\r
if ((emu_opt & 0x400) && (PicoAHW & PAHW_MCD))\r
draw_cd_leds();\r
gp2x_video_changemode(8);\r
} else if (currentConfig.EmuOpt&0x80) {\r
gp2x_video_changemode(16);\r
+#ifdef USE_320_SCREEN\r
+ PicoDrawSetColorFormat(1);\r
+ PicoScanBegin = EmuScanBegin16;\r
+#else\r
PicoDrawSetColorFormat(-1);\r
PicoScanEnd = EmuScanEnd16;\r
+#endif\r
} else {\r
gp2x_video_changemode(8);\r
PicoDrawSetColorFormat(2);\r
currentConfig.EmuOpt |= 0x80;\r
\r
//vidResetMode();\r
+#ifdef USE_320_SCREEN\r
+ PicoDrawSetColorFormat(1);\r
+ PicoScanBegin = EmuScanBegin16;\r
+#else\r
PicoDrawSetColorFormat(-1);\r
PicoScanEnd = EmuScanEnd16;\r
+#endif\r
Pico.m.dirtyPal = 1;\r
PicoFrameDrawOnly();\r
\r
{\r
#ifdef BENCHMARK\r
static int bench = 0, bench_fps = 0, bench_fps_s = 0, bfp = 0, bf[4];\r
- if (++bench == 10) {\r
+ if (++bench == 4) {\r
bench = 0;\r
- bench_fps_s = bench_fps;\r
- bf[bfp++ & 3] = bench_fps;\r
+ bench_fps_s = bench_fps / 4;\r
+ bf[bfp++ & 3] = bench_fps / 4;\r
bench_fps = 0;\r
}\r
bench_fps += frames_shown;\r
- sprintf(fpsbuff, "%02i/%02i/%02i", frames_shown, bench_fps_s, (bf[0]+bf[1]+bf[2]+bf[3])>>2);\r
+ sprintf(fpsbuff, "%3i/%3i/%3i", frames_shown, bench_fps_s, (bf[0]+bf[1]+bf[2]+bf[3])>>2);\r
#else\r
if (currentConfig.EmuOpt & 2) {\r
- //sprintf(fpsbuff, "%02i/%02i", frames_shown, frames_done);\r
- sprintf(fpsbuff, "%4i", frames_shown);\r
+ sprintf(fpsbuff, "%3i/%3i", frames_shown, frames_done);\r
if (fpsbuff[5] == 0) { fpsbuff[5] = fpsbuff[6] = ' '; fpsbuff[7] = 0; }\r
}\r
#endif\r