From: notaz Date: Thu, 22 Mar 2007 19:22:55 +0000 (+0000) Subject: docs updated, gfx_cd works(?) X-Git-Tag: v1.85~737 X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=01bc6b19934c89aef5a4def364b8eb61aae3f199;p=picodrive.git docs updated, gfx_cd works(?) git-svn-id: file:///home/notaz/opt/svn/PicoDrive@74 be3aeb3a-fb24-0410-a615-afba39da0efa --- diff --git a/Pico/cd/gfx_cd.c b/Pico/cd/gfx_cd.c index 46eb374b..64b52ddf 100644 --- a/Pico/cd/gfx_cd.c +++ b/Pico/cd/gfx_cd.c @@ -29,36 +29,6 @@ static const int Table_Rot_Time[] = }; -#if 1*0 -typedef struct -{ - unsigned int Reg_58; // Stamp_Size - unsigned int Reg_5A; - unsigned int Reg_5C; - unsigned int Reg_5E; - unsigned int Reg_60; - unsigned int Reg_62; - unsigned int Reg_64; // V_Dot - unsigned int Reg_66; - - unsigned int Stamp_Map_Adr; - unsigned int Buffer_Adr; - unsigned int Vector_Adr; - unsigned int Function; // Jmp_Adr; - unsigned int Float_Part; - unsigned int Draw_Speed; - - unsigned int XS; - unsigned int YS; - /*unsigned*/ int DXS; - /*unsigned*/ int DYS; - unsigned int XD; - unsigned int YD; - unsigned int XD_Mul; - unsigned int H_Dot; -} Rot_Comp; -#endif - static void gfx_cd_start(void) { int upd_len; @@ -126,8 +96,6 @@ static void gfx_do(void) rot_comp.DYS = rot_comp.DXS >> 16; rot_comp.DXS = (rot_comp.DXS << 16) >> 16; // sign extend rot_comp.Vector_Adr += 8; - //if ((rot_comp.H_Dot & 0x1ff) == 0) - // goto nothing_to_draw; // MAKE_IMAGE_LINE while (rot_comp.H_Dot) @@ -136,12 +104,12 @@ static void gfx_do(void) { if (func & 4) // 16x16 screen { - eax = (ecx >> (11+5)) & 0x7f; + eax = (ecx >> (11+5)) & 0x007f; ebx = (edx >> (11-2)) & 0x3f80; } else // 1x1 screen { - eax = (ecx >> (11+5)) & 0x0f; + eax = (ecx >> (11+5)) & 0x07; ebx = (edx >> (11+2)) & 0x38; } } @@ -149,7 +117,7 @@ static void gfx_do(void) { if (func & 4) // 16x16 screen { - eax = (ecx >> (11+4)) & 0xff; + eax = (ecx >> (11+4)) & 0x00ff; ebx = (edx >> (11-4)) & 0xff00; } else // 1x1 screen @@ -160,7 +128,7 @@ static void gfx_do(void) } ebx += eax; - esi = rot_comp.Stamp_Map_Adr; + // esi = rot_comp.Stamp_Map_Adr; ptrs = (unsigned short *) (Pico_mcd->word_ram2M + rot_comp.Stamp_Map_Adr + ebx*2); edi = ptrs[0] | (ptrs[1] << 16); @@ -191,131 +159,102 @@ static void gfx_do(void) ebx += esi; edi = (eax & 0x3800) ^ 0x1000; // bswap eax = ((eax >> 8) & 0x40) + ebx; - pixel = *(Pico_mcd->word_ram2M + (edi >> 12) + eax); - if (!(edi & 0x800)) pixel >>= 4; break; case 0x01: // No_Flip_0, 32x32 dots ebx = (ebx >> 9) & 0x7c; ebx += esi; edi = (eax & 0x3800) ^ 0x1000; // bswap eax = ((eax >> 7) & 0x180) + ebx; - pixel = *(Pico_mcd->word_ram2M + (edi >> 12) + eax); - if (!(edi & 0x800)) pixel >>= 4; break; case 0x02: // No_Flip_90, 16x16 dots eax = (eax >> 9) & 0x3c; eax += esi; edi = (ebx & 0x3800) ^ 0x2800; // bswap eax += ((ebx >> 8) & 0x40) ^ 0x40; - pixel = *(Pico_mcd->word_ram2M + (edi >> 12) + eax); - if (!(edi & 0x800)) pixel >>= 4; break; case 0x03: // No_Flip_90, 32x32 dots eax = (eax >> 9) & 0x7c; eax += esi; edi = (ebx & 0x3800) ^ 0x2800; // bswap - eax += (ebx >> 7) & 0x180; - pixel = *(Pico_mcd->word_ram2M + (edi >> 12) + eax); - if (!(edi & 0x800)) pixel >>= 4; + eax += ((ebx >> 7) & 0x180) ^ 0x180; break; case 0x04: // No_Flip_180, 16x16 dots ebx = ((ebx >> 9) & 0x3c) ^ 0x3c; ebx += esi; edi = (eax & 0x3800) ^ 0x2800; // bswap and flip eax = (((eax >> 8) & 0x40) ^ 0x40) + ebx; - pixel = *(Pico_mcd->word_ram2M + (edi >> 12) + eax); - if (!(edi & 0x800)) pixel >>= 4; break; case 0x05: // No_Flip_180, 32x32 dots ebx = ((ebx >> 9) & 0x7c) ^ 0x7c; ebx += esi; edi = (eax & 0x3800) ^ 0x2800; // bswap and flip eax = (((eax >> 7) & 0x180) ^ 0x180) + ebx; - pixel = *(Pico_mcd->word_ram2M + (edi >> 12) + eax); - if (!(edi & 0x800)) pixel >>= 4; break; case 0x06: // No_Flip_270, 16x16 dots eax = ((eax >> 9) & 0x3c) ^ 0x3c; eax += esi; edi = (ebx & 0x3800) ^ 0x1000; // bswap eax += (ebx >> 8) & 0x40; - pixel = *(Pico_mcd->word_ram2M + (edi >> 12) + eax); - if (!(edi & 0x800)) pixel >>= 4; break; case 0x07: // No_Flip_270, 32x32 dots eax = ((eax >> 9) & 0x7c) ^ 0x7c; eax += esi; edi = (ebx & 0x3800) ^ 0x1000; // bswap eax += (ebx >> 7) & 0x180; - pixel = *(Pico_mcd->word_ram2M + (edi >> 12) + eax); - if (!(edi & 0x800)) pixel >>= 4; break; case 0x08: // Flip_0, 16x16 dots - ebx = ((ebx >> 9) & 0x3c) ^ 0x3c; + ebx = (ebx >> 9) & 0x3c; ebx += esi; edi = (eax & 0x3800) ^ 0x2800; // bswap, flip eax = (((eax >> 8) & 0x40) ^ 0x40) + ebx; - pixel = *(Pico_mcd->word_ram2M + (edi >> 12) + eax); - if (!(edi & 0x800)) pixel >>= 4; break; case 0x09: // Flip_0, 32x32 dots - ebx = ((ebx >> 9) & 0x7c) ^ 0x7c; + ebx = (ebx >> 9) & 0x7c; ebx += esi; edi = (eax & 0x3800) ^ 0x2800; // bswap, flip eax = (((eax >> 7) & 0x180) ^ 0x180) + ebx; - pixel = *(Pico_mcd->word_ram2M + (edi >> 12) + eax); - if (!(edi & 0x800)) pixel >>= 4; break; case 0x0a: // Flip_90, 16x16 dots eax = ((eax >> 9) & 0x3c) ^ 0x3c; eax += esi; edi = (ebx & 0x3800) ^ 0x2800; // bswap, flip eax += ((ebx >> 8) & 0x40) ^ 0x40; - pixel = *(Pico_mcd->word_ram2M + (edi >> 12) + eax); - if (!(edi & 0x800)) pixel >>= 4; break; case 0x0b: // Flip_90, 32x32 dots eax = ((eax >> 9) & 0x7c) ^ 0x7c; eax += esi; edi = (ebx & 0x3800) ^ 0x2800; // bswap, flip eax += ((ebx >> 7) & 0x180) ^ 0x180; - pixel = *(Pico_mcd->word_ram2M + (edi >> 12) + eax); - if (!(edi & 0x800)) pixel >>= 4; break; case 0x0c: // Flip_180, 16x16 dots ebx = ((ebx >> 9) & 0x3c) ^ 0x3c; ebx += esi; edi = (eax & 0x3800) ^ 0x1000; // bswap eax = ((eax >> 8) & 0x40) + ebx; - pixel = *(Pico_mcd->word_ram2M + (edi >> 12) + eax); - if (!(edi & 0x800)) pixel >>= 4; break; case 0x0d: // Flip_180, 32x32 dots ebx = ((ebx >> 9) & 0x7c) ^ 0x7c; ebx += esi; edi = (eax & 0x3800) ^ 0x1000; // bswap eax = ((eax >> 7) & 0x180) + ebx; - pixel = *(Pico_mcd->word_ram2M + (edi >> 12) + eax); - if (!(edi & 0x800)) pixel >>= 4; break; case 0x0e: // Flip_270, 16x16 dots eax = (eax >> 9) & 0x3c; eax += esi; edi = (ebx & 0x3800) ^ 0x1000; // bswap, flip eax += (ebx >> 8) & 0x40; - pixel = *(Pico_mcd->word_ram2M + (edi >> 12) + eax); - if (!(edi & 0x800)) pixel >>= 4; break; case 0x0f: // Flip_270, 32x32 dots eax = (eax >> 9) & 0x7c; eax += esi; edi = (ebx & 0x3800) ^ 0x1000; // bswap, flip eax += (ebx >> 7) & 0x180; - pixel = *(Pico_mcd->word_ram2M + (edi >> 12) + eax); - if (!(edi & 0x800)) pixel >>= 4; break; } + pixel = *(Pico_mcd->word_ram2M + (edi >> 12) + eax); + if (!(edi & 0x800)) pixel >>= 4; + Pixel_Out: // pixel = 0; //Finish: diff --git a/Pico/cd/gfx_cd.h b/Pico/cd/gfx_cd.h index 5fb713d0..c6c71821 100644 --- a/Pico/cd/gfx_cd.h +++ b/Pico/cd/gfx_cd.h @@ -22,8 +22,8 @@ typedef struct unsigned int XS; unsigned int YS; - unsigned int DXS; - unsigned int DYS; + /*unsigned*/ int DXS; + /*unsigned*/ int DYS; unsigned int XD; unsigned int YD; unsigned int XD_Mul; diff --git a/platform/gp2x/config.txt b/platform/gp2x/config.txt index 0874946b..72239da9 100644 --- a/platform/gp2x/config.txt +++ b/platform/gp2x/config.txt @@ -1,6 +1,9 @@ As PicoDrive is multiplatform emulator, this is GP2X specific part of readme about configuration. +If you have questions, you can use GP32X to ask for help. +http://www.gp32x.com/board/index.php?showforum=48 + Configuration ------------- @@ -16,9 +19,9 @@ Other two are accurate line-based renderers. The 8bit is faster but does not run well with some games like Street Racer. 2. "Accurate timing" -This adds some more emulation precision, but slows the emulation down. Whithout +This adds some more emulation precision, but slows the emulation down. Without this option some games do not boot (Red Zone for example), others have sound -problems. +problems. This options has no effect for Sega/Mega CD emulation. 3. "Accurate sprites" This option improves emulation of sprite priorities, it also enables emulation @@ -52,29 +55,34 @@ go and reconfigure your keys, you will be able to bind X,Y,Z and mode actions. 10. "Genesis Region" This option lets you force the game to think it is running on machine from the -specified region. +specified region, or just to set autodetection order. Also affects Sega/Mega CD. -11. "Use SRAM savestates" -This will automatically read/write SRAM savestates for games which are using them. -SRAM is saved whenever you pause your game or exit the emulator. +11. "Use SRAM/BRAM savestates" +This will automatically read/write SRAM (or BRAM for Sega/Mega CD) savestates for +games which are using them. SRAM is saved whenever you pause your game or exit the +emulator. 12. "GP2X CPU clocks" Here you can change clocks of both GP2X's CPUs. Larger values increase performance. There is no separate option for the second CPU because both CPUs use the same clock source. Setting this option to 200 will cause PicoDrive NOT to change GP2X's clocks -at all. +at all (this is if you use external program to set clock). + +13. "[Sega/Mega CD options]" +Enters Sega/Mega CD options menu (see below). -13. "[advanced options]" +14. "[advanced options]" Enters advanced options menu (see below). -14. "Save cfg as default" +15. "Save cfg as default" If you save your config here it will be loaded on next ROM load, but only if there is no game specific config saved (which will be loaded in that case). -15. "Save cfg for current game only" +16. "Save cfg for current game only" Whenever you load current ROM again these settings will be loaded (squidgehack and RAM settings will not take effect until emulator is restarted). + Advanced configuration ---------------------- @@ -108,25 +116,56 @@ startup, and this data is lost when sound chips are being enabled/disabled. This will always apply gzip compression on your savestates, allowing you to save some space and load/save time. -7. "USB joy controls player X" -If you are able to use USB joysticks with your GP2X, this options selects which -player the joystick controls. - -8. "Don't save config on exit" +7. "Don't save config on exit" This will disable config autowrite on exit (which might cause SD card corruption according to DaveC). -9. "craigix's RAM timings" +8. "craigix's RAM timings" This overclocks the GP2X RAM chips, but may cause instability. Recommended if you use the second core for sound. Needs emulator restart to take effect. See this thread: http://www.gp32x.com/board/index.php?showtopic=32319 -10. "squidgehack" +9. "squidgehack" Well known way to improve the GP2X performance. You must restart the emulator for the change of this option to take effect. +Sega/Mega CD options +-------------------- + +1,2,3. "USA/EUR/JAP BIOS" +These options just shows if your BIOS files were correctly detected be the +emulator (it shows the filename it is using). If so, you can press Start to test +your BIOS. + +4. "CD LEDs" +The Sega/Mega CD unit had two blinking LEDs (red and green) on it. This option +will display them on left-top corner of the screen. + +5. "CDDA audio (using mp3s)" +This option enables CD audio playback. + +6. "PCM audio" +This enables 8 channel PCM sound source. It is required for some games to run, +because they monitor state of the audio chip. + +7. "ReadAhead buffer" +This option is for dealing with slow SD card access in GP2X, which makes FMV +games unplayable. It will allow emulator not to access SD card for longer periods +of time, but it will take more time to fill the buffer. + +8. "Scale/Rot. fx" +The Sega/Mega CD had scaling/rotation chip, which allows effects similar to +"Mode 7" effects in SNES. Unfortunately emulating it is slow, and very few games +used it, so it's better to disable this option. + +9. "Better sync" +This option is similar to "Perfect synchro" in Gens. Some games require it to run, +for example most (all?) Wolfteam games, and some other ones. Don't use it for +games which don't need it, it will just slow them down. + + Key configuration ----------------- diff --git a/platform/gp2x/emu.c b/platform/gp2x/emu.c index ce056b3e..7c63cdb4 100644 --- a/platform/gp2x/emu.c +++ b/platform/gp2x/emu.c @@ -969,13 +969,15 @@ static void updateSound(int len) { if (PicoOpt&8) len<<=1; - gp2x_sound_write(PsndOut, len<<1); + /* avoid writing audio when lagging behind to prevent audio lag */ + if (PicoSkipFrame != 2) + gp2x_sound_write(PsndOut, len<<1); } -static void SkipFrame(void) +static void SkipFrame(int do_audio) { - PicoSkipFrame=1; + PicoSkipFrame=do_audio ? 1 : 2; PicoFrame(); PicoSkipFrame=0; } @@ -1157,7 +1159,7 @@ void emu_Loop(void) // when second changes, but we don't want buffer to starve. if(PsndOut && frames_done < target_fps && frames_done > target_fps-5) { updateKeys(); - SkipFrame(); frames_done++; + SkipFrame(1); frames_done++; } frames_done -= target_fps; if (frames_done < 0) frames_done = 0; @@ -1170,7 +1172,7 @@ void emu_Loop(void) if(currentConfig.Frameskip >= 0) { // frameskip enabled for(i = 0; i < currentConfig.Frameskip; i++) { updateKeys(); - SkipFrame(); frames_done++; + SkipFrame(1); frames_done++; if (PsndOut) { // do framelimitting if sound is enabled gettimeofday(&tval, 0); if(thissec != tval.tv_sec) tval.tv_usec+=1000000; @@ -1189,7 +1191,7 @@ void emu_Loop(void) continue; } updateKeys(); - SkipFrame(/*tval.tv_usec < lim_time+target_frametime*/); frames_done++; + SkipFrame(tval.tv_usec < lim_time+target_frametime); frames_done++; continue; } diff --git a/platform/linux/Makefile b/platform/linux/Makefile index 0b8c37bd..9a8f3df8 100644 --- a/platform/linux/Makefile +++ b/platform/linux/Makefile @@ -63,10 +63,11 @@ clean: tidy tidy: @$(RM) $(OBJS) @make -C ../../cpu/mz80/ clean + @make -C ../gp2x/helix/ X86=1 clean -PicoDrive : $(OBJS) +PicoDrive : $(OBJS) ../gp2x/helix/helix_mp3_x86.a @echo $@ - @$(GCC) $(COPT) $(OBJS) ../gp2x/helix/helix_mp3_x86.a $(LDFLAGS) -lm -Wl,-Map=PicoDrive.map -o $@ + @$(GCC) $(COPT) $^ $(LDFLAGS) -lm -Wl,-Map=PicoDrive.map -o $@ ../../cpu/mz80/mz80.o : ../../cpu/mz80/mz80.asm @@ -76,6 +77,9 @@ PicoDrive : $(OBJS) ../../cpu/mz80/mz80.asm : @make -C ../../cpu/mz80/ +../gp2x/helix/helix_mp3_x86.a: + @make -C ../gp2x/helix/ X86=1 clean all + .c.o: @echo $< @$(GCC) $(COPT) $(DEFINC) -c $< -o $@ diff --git a/platform/linux/port_config.h b/platform/linux/port_config.h index a0a855ad..e5c88bba 100644 --- a/platform/linux/port_config.h +++ b/platform/linux/port_config.h @@ -12,8 +12,8 @@ // pico.c #define CAN_HANDLE_240_LINES 1 -//#define dprintf(f,...) printf("%05i:%03i: " f "\n",Pico.m.frame_count,Pico.m.scanline,##__VA_ARGS__) -#define dprintf(x...) +#define dprintf(f,...) printf("%05i:%03i: " f "\n",Pico.m.frame_count,Pico.m.scanline,##__VA_ARGS__) +//#define dprintf(x...) #endif //PORT_CONFIG_H diff --git a/platform/readme.txt b/platform/readme.txt index 2274642c..f56ba574 100644 --- a/platform/readme.txt +++ b/platform/readme.txt @@ -1,14 +1,17 @@ +For help / comments / questions visit GP32X boards at: +http://www.gp32x.com/board/ + About ----- -This version of PicoDrive is another enhanced version of Dave's -Megadrive / Genesis emulator for Pocket PC, which now can also emulate -Sega/Mega CD. The original Dave's code was heavily modified (including -Cyclone core), parts of it were rewritten in asm, many features added, -accuracy increased. Sega/Mega CD emulation is mostly based on Gens code. -This version is aimed at ARM-based handheld devices, so ports exist for -GP2X handheld console, Symbian smartphones and other devices. +This is yet another Megadrive / Genesis / Sega CD / Mega CD emulator, which +was written having ARM-based handheld devices in mind (such as PDAs, +smartphones and handheld consoles like GP2X of course). The critical parts +(renderer, 68K and Z80 cpu interpreters) and some other random code is +written in ARM asm, other code is C. The base code originates from Dave's +(fdave, finalburn) PicoDrive 0.30 for Pocket PC. The Sega/Mega CD code is +roughly based on Stephane Dallongeville's Gens. How to make it run