From fcf94fcc20e7bdd527a28fe8e1b265862b616016 Mon Sep 17 00:00:00 2001 From: notaz Date: Wed, 6 Aug 2008 20:04:23 +0000 Subject: [PATCH] idle loop hack, psp bugfix, plat debug str git-svn-id: file:///home/notaz/opt/svn/PicoDrive@566 be3aeb3a-fb24-0410-a615-afba39da0efa --- cpu/Cyclone/tools/idle.s | 8 ++++---- cpu/fame/famec.c | 8 ++++++++ cpu/fame/famec_opcodes.h | 12 ++++++------ platform/common/emu.h | 1 + platform/common/menu.c | 5 ++++- platform/gp2x/emu.c | 5 +++++ platform/gp2x/version.h | 2 +- platform/psp/emu.c | 10 ++++++++-- platform/psp/menu.c | 1 + platform/psp/version.h | 2 +- 10 files changed, 39 insertions(+), 15 deletions(-) diff --git a/cpu/Cyclone/tools/idle.s b/cpu/Cyclone/tools/idle.s index c865f806..a8b7ccaf 100644 --- a/cpu/Cyclone/tools/idle.s +++ b/cpu/Cyclone/tools/idle.s @@ -99,19 +99,19 @@ cfi_loop: .endm idle_bra: - mov r5, #4 + mov r5, #2 inc_counter b Op6001 idle_bne: - msr cpsr_flg, r10 ;@ ARM flags = 68000 flags - movne r5, #4 + msr cpsr_flg, r10 + movne r5, #2 @ 2 is intentional due to strange timing issues inc_counter ne b Op6601 idle_beq: msr cpsr_flg, r10 ;@ ARM flags = 68000 flags - moveq r5, #4 + moveq r5, #2 inc_counter eq b Op6701 diff --git a/cpu/fame/famec.c b/cpu/fame/famec.c index 8469131c..613f58f2 100644 --- a/cpu/fame/famec.c +++ b/cpu/fame/famec.c @@ -262,6 +262,10 @@ typedef signed int s32; goto famec_Exec; #endif +#define RET0() \ + m68kcontext.io_cycle_counter = -6; \ + goto famec_End; + #else #define NEXT \ @@ -274,6 +278,10 @@ typedef signed int s32; m68kcontext.io_cycle_counter -= (A); \ return; +#define RET0() \ + m68kcontext.io_cycle_counter = -6; \ + return; + #endif #define M68K_PPL (m68kcontext.sr >> 8) & 7 diff --git a/cpu/fame/famec_opcodes.h b/cpu/fame/famec_opcodes.h index 96e46751..551d7571 100644 --- a/cpu/fame/famec_opcodes.h +++ b/cpu/fame/famec_opcodes.h @@ -19263,8 +19263,7 @@ OPCODE(0x4E72) ASP = res; } m68kcontext.execinfo |= FM68K_HALTED; - m68kcontext.io_cycle_counter = 0; -RET(4) +RET0() } // RTE @@ -39984,8 +39983,7 @@ OPCODE(0x6001_idle) PC += ((s8)(Opcode & 0xFE)) >> 1; #endif UPDATE_IDLE_COUNT - m68kcontext.io_cycle_counter = 10; -RET(10) +RET0() } // BCC @@ -39995,7 +39993,8 @@ OPCODE(0x6601_idle) { UPDATE_IDLE_COUNT PC += ((s8)(Opcode & 0xFE)) >> 1; - m68kcontext.io_cycle_counter = 8; + //if (idle_hit) + RET0() } RET(8) } @@ -40006,7 +40005,8 @@ OPCODE(0x6701_idle) { UPDATE_IDLE_COUNT PC += ((s8)(Opcode & 0xFE)) >> 1; - m68kcontext.io_cycle_counter = 8; + //if (idle_hit) + RET0() } RET(8) } diff --git a/platform/common/emu.h b/platform/common/emu.h index 9ba0219d..7c5e89b4 100644 --- a/platform/common/emu.h +++ b/platform/common/emu.h @@ -61,3 +61,4 @@ void emu_DoTurbo(int *pad, int acts); extern const char * const keyNames[]; void emu_prepareDefaultConfig(void); +void emu_platformDebugCat(char *str); diff --git a/platform/common/menu.c b/platform/common/menu.c index 00afc34b..0f3fb61f 100644 --- a/platform/common/menu.c +++ b/platform/common/menu.c @@ -405,13 +405,16 @@ void debug_menu_loop(void) { int inp, mode = 0; int spr_offs = 0, dumped = 0; + char *tmp; while (1) { switch (mode) { case 0: menu_draw_begin(); - draw_text_debug(PDebugMain(), 0, 0); + tmp = PDebugMain(); + emu_platformDebugCat(tmp); + draw_text_debug(tmp, 0, 0); if (dumped) { smalltext_out16(SCREEN_WIDTH-6*10, SCREEN_HEIGHT-8, "dumped", 0xffff); dumped = 0; diff --git a/platform/gp2x/emu.c b/platform/gp2x/emu.c index 9afa61b6..12d70e3d 100644 --- a/platform/gp2x/emu.c +++ b/platform/gp2x/emu.c @@ -719,6 +719,11 @@ void emu_forcedFrame(int opts) currentConfig.EmuOpt = eo_old; } +void emu_platformDebugCat(char *str) +{ + // nothing +} + static void simpleWait(int thissec, int lim_time) { struct timeval tval; diff --git a/platform/gp2x/version.h b/platform/gp2x/version.h index fd18b427..f4019d90 100644 --- a/platform/gp2x/version.h +++ b/platform/gp2x/version.h @@ -1,2 +1,2 @@ -#define VERSION "1.51a" +#define VERSION "1.51b" diff --git a/platform/psp/emu.c b/platform/psp/emu.c index 11b5e3f1..b0504191 100644 --- a/platform/psp/emu.c +++ b/platform/psp/emu.c @@ -274,7 +274,7 @@ static void do_pal_update(int allow_sh, int allow_as) } else if (allow_as && (rendstatus & PDRAW_ACC_SPRITES)) { - memcpy32((int *)(void *)(localPal+0x80), (void *)localPal, 0x40/2); + memcpy32((int *)dpal+0x80/2, (void *)localPal, 0x40*2/4); } } @@ -296,6 +296,7 @@ static void EmuScanPrepare(void) if (dynamic_palette > 0) dynamic_palette--; + if (Pico.m.dirtyPal) do_pal_update(1, 1); if ((rendstatus & PDRAW_ACC_SPRITES) && !(Pico.video.reg[0xC]&8)) @@ -322,7 +323,7 @@ static int EmuScanSlowEnd(unsigned int num) do_slowmode_lines(num); dynamic_palette = 3; // last for 2 more frames } - do_pal_update(1, 0); + do_pal_update(1, 1); } if (dynamic_palette) { @@ -534,6 +535,11 @@ static void vidResetMode(void) sceGuSync(0,0); } +void emu_platformDebugCat(char *str) +{ + strcat(str, blit_16bit_mode ? "soft clut\n" : "hard clut\n"); +} + /* sound stuff */ #define SOUND_BLOCK_SIZE_NTSC (1470*2) // 1024 // 1152 diff --git a/platform/psp/menu.c b/platform/psp/menu.c index 5768a9c2..d348a573 100644 --- a/platform/psp/menu.c +++ b/platform/psp/menu.c @@ -1161,6 +1161,7 @@ menu_entry opt2_entries[] = { "gzip savestates", MB_ONOFF, MA_OPT2_GZIP_STATES, ¤tConfig.EmuOpt, 0x00008, 0, 0, 1, 1 }, { "Don't save last used ROM", MB_ONOFF, MA_OPT2_NO_LAST_ROM, ¤tConfig.EmuOpt, 0x00020, 0, 0, 1, 1 }, { "Status line in main menu", MB_ONOFF, MA_OPT2_STATUS_LINE, ¤tConfig.EmuOpt, 0x20000, 0, 0, 1, 1 }, + { "Disable idle loop patching",MB_ONOFF, MA_OPT2_NO_IDLE_LOOPS, &PicoOpt, 0x80000, 0, 0, 1, 1 }, { "Disable frame limiter", MB_ONOFF, MA_OPT2_NO_FRAME_LIMIT, ¤tConfig.EmuOpt, 0x40000, 0, 0, 1, 1 }, { "done", MB_NONE, MA_OPT2_DONE, NULL, 0, 0, 0, 1, 0 }, }; diff --git a/platform/psp/version.h b/platform/psp/version.h index fd18b427..f4019d90 100644 --- a/platform/psp/version.h +++ b/platform/psp/version.h @@ -1,2 +1,2 @@ -#define VERSION "1.51a" +#define VERSION "1.51b" -- 2.39.5