}\r
\r
// Draw tiles across screen:\r
- for (; tilex < tend; tilex++)\r
+ if (!sh)\r
{\r
- int addr=0,zero=0;\r
- int pal;\r
+ for (; tilex < tend; tilex++)\r
+ {\r
+ int addr=0,zero=0;\r
+ int pal;\r
+\r
+ code=Pico.vram[nametab+tilex];\r
+ if(code==blank) continue;\r
+ if((code>>15) != prio) {\r
+ rendstatus|=2;\r
+ continue;\r
+ }\r
\r
- code=Pico.vram[nametab+tilex];\r
- if(code==blank) continue;\r
- if((code>>15) != prio) {\r
- rendstatus|=2;\r
- continue;\r
+ pal=((code>>9)&0x30);\r
+\r
+ // Get tile address/2:\r
+ addr=(code&0x7ff)<<4;\r
+ if (code&0x1000) addr+=14-ty; else addr+=ty; // Y-flip\r
+\r
+ if (code&0x0800) zero=TileFlip(8+(tilex<<3),addr,pal);\r
+ else zero=TileNorm(8+(tilex<<3),addr,pal);\r
+\r
+ if (zero) blank=code; // We know this tile is blank now\r
}\r
+ }\r
+ else\r
+ {\r
+ for (; tilex < tend; tilex++)\r
+ {\r
+ int addr=0,zero=0;\r
+ int pal, tmp, *zb;\r
+\r
+ code=Pico.vram[nametab+tilex];\r
+ if(code==blank) continue;\r
+ if((code>>15) != prio) {\r
+ rendstatus|=2;\r
+ continue;\r
+ }\r
\r
- pal=((code>>9)&0x30);\r
+ pal=((code>>9)&0x30);\r
\r
- if(sh) {\r
- int tmp, *zb = (int *)(HighCol+8+(tilex<<3));\r
+ zb = (int *)(HighCol+8+(tilex<<3));\r
if(prio) {\r
tmp = *zb;\r
if(!(tmp&0x00000080)) tmp&=~0x000000c0; if(!(tmp&0x00008000)) tmp&=~0x0000c000;\r
} else {\r
pal |= 0x40;\r
}\r
- }\r
\r
- // Get tile address/2:\r
- addr=(code&0x7ff)<<4;\r
- if (code&0x1000) addr+=14-ty; else addr+=ty; // Y-flip\r
+ // Get tile address/2:\r
+ addr=(code&0x7ff)<<4;\r
+ if (code&0x1000) addr+=14-ty; else addr+=ty; // Y-flip\r
\r
- if (code&0x0800) zero=TileFlip(8+(tilex<<3),addr,pal);\r
- else zero=TileNorm(8+(tilex<<3),addr,pal);\r
+ if (code&0x0800) zero=TileFlip(8+(tilex<<3),addr,pal);\r
+ else zero=TileNorm(8+(tilex<<3),addr,pal);\r
\r
- if (zero) blank=code; // We know this tile is blank now\r
+ if (zero) blank=code; // We know this tile is blank now\r
+ }\r
}\r
-\r
- // terminate the cache list\r
- //*hcache = 0;\r
}\r
\r
// --------------------------------------------\r
\r
+static void DrawTilesFromCacheShPrep(void)\r
+{\r
+ if (!(rendstatus&0x80))\r
+ {\r
+ // as some layer has covered whole line with hi priority tiles,\r
+ // we can process whole line and then act as if sh/hi mode was off.\r
+ rendstatus|=0x80;\r
+ int c = 320/4, *zb = (int *)(HighCol+8);\r
+ while (c--)\r
+ {\r
+ int tmp = *zb;\r
+ if (!(tmp & 0x80808080)) *zb=tmp&0x3f3f3f3f;\r
+ else {\r
+ if(!(tmp&0x00000080)) tmp&=~0x000000c0; if(!(tmp&0x00008000)) tmp&=~0x0000c000;\r
+ if(!(tmp&0x00800000)) tmp&=~0x00c00000; if(!(tmp&0x80000000)) tmp&=~0xc0000000;\r
+ *zb=tmp;\r
+ }\r
+ zb++;\r
+ }\r
+ }\r
+}\r
+\r
static void DrawTilesFromCache(int *hc, int sh, int rlim)\r
{\r
int code, addr, dx;\r
\r
if (sh && (rendstatus&0xc0))\r
{\r
- if (!(rendstatus&0x80))\r
- {\r
- // as some layer has covered whole line with hi priority tiles,\r
- // we can process whole line and then act as if sh/hi mode was off.\r
- rendstatus|=0x80;\r
- int c = 320/4, *zb = (int *)(HighCol+8);\r
- while (c--)\r
- {\r
- int tmp = *zb;\r
- if (!(tmp & 0x80808080)) *zb=tmp&0x3f3f3f3f;\r
- else {\r
- if(!(tmp&0x00000080)) tmp&=~0x000000c0; if(!(tmp&0x00008000)) tmp&=~0x0000c000;\r
- if(!(tmp&0x00800000)) tmp&=~0x00c00000; if(!(tmp&0x80000000)) tmp&=~0xc0000000;\r
- *zb=tmp;\r
- }\r
- zb++;\r
- }\r
- }\r
+ DrawTilesFromCacheShPrep();\r
sh = 0;\r
}\r
\r
- if (sh)\r
+ if (!sh)\r
{\r
+ short blank=-1; // The tile we know is blank\r
while ((code=*hc++)) {\r
- unsigned char *zb;\r
+ int zero;\r
+ if((short)code == blank) continue;\r
// Get tile address/2:\r
addr=(code&0x7ff)<<4;\r
addr+=(unsigned int)code>>25; // y offset into tile\r
dx=(code>>16)&0x1ff;\r
- zb = HighCol+dx;\r
- if(!(*zb&0x80)) *zb&=0x3f; zb++; if(!(*zb&0x80)) *zb&=0x3f; zb++;\r
- if(!(*zb&0x80)) *zb&=0x3f; zb++; if(!(*zb&0x80)) *zb&=0x3f; zb++;\r
- if(!(*zb&0x80)) *zb&=0x3f; zb++; if(!(*zb&0x80)) *zb&=0x3f; zb++;\r
- if(!(*zb&0x80)) *zb&=0x3f; zb++; if(!(*zb&0x80)) *zb&=0x3f; zb++;\r
\r
pal=((code>>9)&0x30);\r
if (rlim-dx < 0) goto last_cut_tile;\r
\r
- if (code&0x0800) TileFlip(dx,addr,pal);\r
- else TileNorm(dx,addr,pal);\r
+ if (code&0x0800) zero=TileFlip(dx,addr,pal);\r
+ else zero=TileNorm(dx,addr,pal);\r
+\r
+ if (zero) blank=(short)code;\r
}\r
}\r
else\r
{\r
- short blank=-1; // The tile we know is blank\r
while ((code=*hc++)) {\r
- int zero;\r
- if((short)code == blank) continue;\r
+ unsigned char *zb;\r
// Get tile address/2:\r
addr=(code&0x7ff)<<4;\r
addr+=(unsigned int)code>>25; // y offset into tile\r
dx=(code>>16)&0x1ff;\r
+ zb = HighCol+dx;\r
+ if(!(*zb&0x80)) *zb&=0x3f; zb++; if(!(*zb&0x80)) *zb&=0x3f; zb++;\r
+ if(!(*zb&0x80)) *zb&=0x3f; zb++; if(!(*zb&0x80)) *zb&=0x3f; zb++;\r
+ if(!(*zb&0x80)) *zb&=0x3f; zb++; if(!(*zb&0x80)) *zb&=0x3f; zb++;\r
+ if(!(*zb&0x80)) *zb&=0x3f; zb++; if(!(*zb&0x80)) *zb&=0x3f; zb++;\r
\r
pal=((code>>9)&0x30);\r
if (rlim-dx < 0) goto last_cut_tile;\r
\r
- if (code&0x0800) zero=TileFlip(dx,addr,pal);\r
- else zero=TileNorm(dx,addr,pal);\r
-\r
- if (zero) blank=(short)code;\r
+ if (code&0x0800) TileFlip(dx,addr,pal);\r
+ else TileNorm(dx,addr,pal);\r
}\r
}\r
return;\r
About\r
-----\r
\r
+#ifdef PSP\r
+This is yet another Megadrive / Genesis emulator for PSP, but with\r
+Sega CD / Mega CD support. Although it has been originally written having\r
+ARM CPU based devices in mind, it has now been ported to PSP too, by\r
+replacing ARM specific parts with portable C code.\r
+The base code originates from Dave's (fdave, finalburn) PicoDrive 0.30 for\r
+Pocket PC. The Sega/Mega CD code is roughly based on Stephane Dallongeville's\r
+Gens.\r
+#else\r
This is yet another Megadrive / Genesis / Sega CD / Mega CD emulator, which\r
was written having ARM-based handheld devices in mind (such as PDAs,\r
smartphones and handheld consoles like GP2X and Gizmondo of course).\r
random code is written in ARM asm, other code is C. The base code originates\r
from Dave's (fdave, finalburn) PicoDrive 0.30 for Pocket PC. The Sega/Mega CD\r
code is roughly based on Stephane Dallongeville's Gens.\r
+#endif\r
\r
\r
How to make it run\r
be in .smd or .bin format and can be zipped (one ROM per zip).\r
\r
#endif\r
-If you have any problems (game does not boot, sound is glitchy, broken graphics),\r
-make sure you enable "Accurate timing", "Emulate Z80" and use "16bit accurate\r
-renderer". This way you will get the best compatibility this emulator can\r
-provide.\r
+#ifdef PSP\r
+If you are running a custom firmware, just copy the whole PicoDrive directory to\r
+/PSP/GAME or /PSP/GAMEXXX directory in your memory stick (it shouldn't matter\r
+which one GAME* directory to use).\r
+\r
+If you are on 1.5, you will have to use KXploit tool to create the needed files\r
+and directories, and then copy them to /PSP/GAME. I assume 1.5 users know how to\r
+do this, if not, just google for KXploit.\r
+\r
+#endif\r
+Note that this emulator may require some tweaking of configuration settings to run\r
+some games well. For Genesis/MegaDrive, if you have any problems (game does not\r
+boot, sound is glitchy, broken graphics), try to:\r
+ * enable "Accurate timing" (options menu)\r
+#ifdef PSP\r
+ * enable "accurate renderer"\r
+#else\r
+ * enable "16bit accurate renderer"\r
+#endif\r
+ * make sure Z80 is not disabled (in "advanced options" submenu in options).\r
+Some games may need to be reset after adjusting settings.\r
+\r
For possible Sega/Mega CD problems, see "Other important stuff" section below.\r
\r
\r
Sonic the Hedgehog CD (US) - Track 03.mp3\r
...\r
\r
+It is very important to have the MP3s encoded at 44kHz sample rate and they\r
+must be stereo, or else they will play too fast/slow or won't play at all.\r
+Be sure NOT to use anything but classic mp3 format (don't use things like\r
+mp3pro).\r
+\r
ISO files can also be zipped (but not mp3 files, as they are already\r
compressed). Note that this can cause very long loading times, which may\r
take up to several minutes. File naming is similar as with uncompressed ISOs.\r
---------------------\r
\r
* If your Genesis/MD game hangs or has glitches, this is most likely because\r
- "Accurate timing" option is not enabled, or 8bit fast renderer is used\r
- (try the 16 bit one), or Z80 is disabled in "advanced options".\r
+ "Accurate timing" option is not enabled, or fast renderer is used\r
+ (try the accurate one), or Z80 is disabled in "advanced options".\r
* Sega/Mega CD: If the game hangs after Sega logo, you may need to enable\r
"better sync" and/or "Scale/Rot. fx" options, found in "Sega/Mega CD options"\r
submenu, and then reset the game. Some other games may also require\r
- "CDDA audio" and "PCM audio" to work.\r
+ "CDDA audio" and "PCM audio" to be enabled to work (enabled by default).\r
+ Incorrectly named/missing mp3s may also be the cause.\r
+* Sega/Mega CD: If the background music is missing, you might have named your\r
+ MP3s incorrectly. Read "How to run Sega/Mega CD games" section again.\r
+* Sega/Mega CD: If the game music plays too fast or too slow, you have encoded\r
+ your MP3s incorrectly. You will have to re-encode and/or resample them.\r
+ PicoDrive is not a mp3 player, so all mp3s MUST be encoded at 44.1kHz stereo.\r
+ Badly encoded mp3s can cause various kind of problems, like noises, incorrect\r
+ playback speeds, not repeating music or even prevent game from starting.\r
+* Sega/Mega CD: If your games hangs at the BIOS screen (with planets shown),\r
+ you may be using a bad BIOS dump. Try another from a different source.\r
+* Some Sega/Mega CD games don't use Z80 for anything, but they leave it active,\r
+ so disabling Z80 manually (in advanced options) improves performance.\r
#ifdef GP2X\r
* Sega/Mega CD: if FMV game performance is poor, try adjusting\r
"ReadAhead buffer" to something like 2048K.\r
it may start hanging and producing random noise, or causing ARM940 crashes\r
("940 crashed" message displayed).\r
#endif\r
-* PicoDrive is not a mp3 player, so all mp3s MUST be encoded at 44.1kHz stereo.\r
- Badly encoded mp3s can cause various kind of problems, like noises, incorrect\r
- playback speeds, not repeating music or even prevent game from starting.\r
* Use lower bitrate for better performance (96 or 128kbps CBRs recommended).\r
#ifdef GP2X\r
* Due to internal implementation mp3s must not be larger that 12MB\r
converted to 16bit, as this is what Gizmondo requires. It also introduces\r
graphics problems for some games, so it's best to use 16bit one.\r
#endif\r
+#ifdef PSP\r
+This option allows to switch between fast and accurate renderers. The fast one\r
+is much faster, because it draws the whole frame at a time, instead of doing it\r
+line by line, like the accurate one does. But because of the way it works it\r
+can't render any mid-frame image changes (raster effects), so it is useful only\r
+for some games.\r
+#endif\r
\r
#ifdef GIZ\r
@@0. "Scanline mode"\r
This option was designed to work around slow framebuffer access (the Gizmondo's\r
-main bottleneck) by drawing every other line (even nummbered lines only).\r
+main bottleneck) by drawing every other line (even numbered lines only).\r
This improves performance greatly, but looses detail.\r
\r
#endif\r
see below) for this to make sense (already done by default).\r
\r
@@0. "Sound Quality"\r
-Sound rate and stereo mode. Mono is not available in Sega/Mega CD mode.\r
+#ifdef PSP\r
+Sound sample rate, affects sound quality and emulation performance.\r
+22050Hz setting is the recommended one.\r
+#else\r
+Sound sample rate and stereo mode. Mono is not available in Sega/Mega CD mode.\r
+#endif\r
#ifdef GP2X\r
If you want 44100Hz sound, it is recommended to enable the second core (next option).\r
\r
\r
@@0. "Use SRAM/BRAM savestates"\r
This will automatically read/write SRAM (or BRAM for Sega/Mega CD) savestates for\r
-games which are using them. SRAM is saved whenever you pause your game or exit the\r
+games which are using them. SRAM is saved whenever you enter the menu or exit the\r
emulator.\r
\r
@@0. "Confirm savestate"\r
source. Setting this option to 200 will cause PicoDrive NOT to change GP2X's clocks\r
at all (this is if you use external program to set clock).\r
\r
+#endif\r
+#ifdef PSP\r
+@@0. "CPU/bus clock"\r
+This allows to change CPU and bus clocks for PSP. 333MHz is recommended.\r
+\r
+@@0. "[Display options]"\r
+Enters Display options menu (see below).\r
+\r
#endif\r
@@0. "[Sega/Mega CD options]"\r
Enters Sega/Mega CD options menu (see below).\r
games which don't need it, it will just slow them down.\r
\r
\r
+#ifdef PSP\r
+Display options\r
+---------------\r
+\r
+@@3. "Scale factor"\r
+This allows to resize the displayed image by using the PSP's hardware. The number is\r
+used to multiply width and height of the game image to get the size of image to be\r
+displayed. If you just want to make it fullscreen, just use "Set to fullscreen"\r
+setting below.\r
+\r
+@@3. "Hor. scale (for low res. games)"\r
+This one works similarly as the previous setting, but can be used to apply additional\r
+scaling horizontally, and is used for games which use lower (256 pixel wide) Gen/MD\r
+resolution.\r
+\r
+@@3. "Hor. scale (for hi res. games)"\r
+Same as above, only for higher (320 pixel wide) resolution using games.\r
+\r
+@@3. "Bilinear filtering"\r
+If this is enabled, PSP hardware will apply bilinear filtering on the resulting image,\r
+making it smoother, but blurry.\r
+\r
+@@3. "Wait for vsync"\r
+Wait for the screen to finish updating before switching to next frame, to avoid tearing.\r
+There are 3 options:\r
+* never: don't wait for vsync.\r
+* sometimes: wait only if emulator is running fast enough.\r
+* always: always wait (causes emulation slowdown).\r
+\r
+@@3. "Set to unscaled centered"\r
+Adjust the resizing options to set game image to it's original size.\r
+\r
+@@3. "Set to fullscreen"\r
+Adjust the resizing options to make the game image fullscreen.\r
+\r
+\r
+#endif\r
Key configuration\r
-----------------\r
\r
#ifdef GIZ\r
the right Giz ones, which are assigned to them. If you bind 2 different Giz buttons\r
#endif\r
+#ifdef PSP\r
+the right PSP ones, which are assigned to them. If you bind 2 different PSP buttons\r
+#endif\r
to the same action, you will get a combo (which means that you will have to press\r
both buttons for that action to happen.\r
\r
-----------------\r
\r
Genesis/MegaDrive:\r
+#ifdef PSP\r
+main 68k @ 7.6MHz: yes, FAME/C core\r
+z80 @ 3.6MHz: yes, CZ80 core\r
+#else\r
main 68k @ 7.6MHz: yes, Cyclone core\r
z80 @ 3.6MHz: yes, DrZ80 core\r
+#endif\r
VDP: yes, except some quirks not used by games\r
YM2612 FM: yes, optimized MAME core\r
SN76489 PSG: yes, MAME core\r
\r
Sega/Mega CD:\r
+#ifdef PSP\r
+another 68k @ 12.5MHz: yes, FAME/C too\r
+#else\r
another 68k @ 12.5MHz: yes, Cyclone too\r
+#endif\r
gfx scaling/rotation chip (custom ASIC): yes\r
PCM sound source: yes\r
CD-ROM controller: yes (mostly)\r
This emulator uses code from these people/projects:\r
\r
notaz\r
-GP2X, UIQ, Gizmondo ports, Cyclone 68000 hacks,\r
+GP2X, UIQ, PSP, Gizmondo ports, CPU core hacks,\r
lots of additional coding (see changelog).\r
Homepage: http://notaz.gp2x.de/\r
\r
Cyclone 68000 core, Pico emulation library\r
Homepage: http://www.finalburn.com/\r
\r
+#ifdef PSP\r
+Chui\r
+FAME/C 68k interpreter core\r
+(based on C68K by Stephane Dallongeville)\r
+\r
+Stephane Dallongeville (written), NJ (optimized)\r
+CZ80 Z80 interpreter core\r
+\r
+#else\r
Reesy & FluBBa\r
-DrZ80, the Z80 emulator written in ARM assembly.\r
+DrZ80, the Z80 interpreter written in ARM assembly.\r
Homepage: http://reesy.gp32x.de/\r
\r
-Tatsuyuki Satoh, Jarek Burczynski, MultiArcadeMachineEmulator development\r
+#endif\r
+Tatsuyuki Satoh, Jarek Burczynski, MAME development\r
software implementation of Yamaha FM sound generator\r
\r
-MultiArcadeMachineEmulator (MAME) development\r
-Texas Instruments SN76489 / SN76496 programmable tone /noise generator\r
+MAME development\r
+Texas Instruments SN76489 / SN76496 programmable tone/noise generator\r
Homepage: http://www.mame.net/\r
\r
Stephane Dallongeville\r
Gens, MD/Mega CD/32X emulator. Most Sega CD code is based on this emu.\r
+#ifdef PSP\r
+\r
+people @ ps2dev.org forums / PSPSDK crew\r
+libaudiocodec code (by cooleyes)\r
+other sample code\r
+#else\r
\r
Helix community\r
Helix mp3 decoder\r
+#endif\r
\r
\r
Additional thanks\r
\r
Changelog\r
---------\r
+1.35\r
+ + PSP port added. Lots of new code for it. Integrated modified FAME/C, CZ80 cores.\r
+ + Some minor generic optimizations.\r
+ * Patched some code which was crashing under PSP, but was working in GP2X/Giz\r
+ (although it should have crashed there too).\r
+ * Readme updated.\r
+\r
1.34\r
+ Gizmondo port added.\r
+ Some new optimizations in memory handlers, and for shadow/hilight mode.\r