1.20 release

git-svn-id: file:///home/notaz/opt/svn/PicoDrive@57 be3aeb3a-fb24-0410-a615-afba39da0efa
This commit is contained in:
notaz 2007-02-25 23:04:33 +00:00
parent 860c6322c3
commit 68cba51e20
8 changed files with 93 additions and 53 deletions

View file

@ -31,6 +31,7 @@ void mp3_update(int *buffer, int length, int stereo);
// enable_ym2612&dac, enable_sn76496, enable_z80, stereo_sound, // enable_ym2612&dac, enable_sn76496, enable_z80, stereo_sound,
// alt_renderer, 6button_gamepad, accurate_timing, accurate_sprites, // alt_renderer, 6button_gamepad, accurate_timing, accurate_sprites,
// draw_no_32col_border, external_ym2612, enable_pcm, enable cdda // draw_no_32col_border, external_ym2612, enable_pcm, enable cdda
// enable_cdgfx, cd_perfect_sync
extern int PicoOpt; extern int PicoOpt;
extern int PicoVer; extern int PicoVer;
extern int PicoSkipFrame; // skip rendering frame, but still do sound (if enabled) and emulation stuff extern int PicoSkipFrame; // skip rendering frame, but still do sound (if enabled) and emulation stuff

View file

@ -29,6 +29,7 @@ typedef unsigned int u32;
//#define __debug_io2 //#define __debug_io2
//#define rdprintf dprintf //#define rdprintf dprintf
#define rdprintf(...) #define rdprintf(...)
//#define wrdprintf dprintf
#define wrdprintf(...) #define wrdprintf(...)
// ----------------------------------------------------------------- // -----------------------------------------------------------------
@ -698,11 +699,11 @@ u8 PicoReadS68k8(u32 a)
} }
// word RAM (1M area) // word RAM (1M area)
if ((a&0xfe0000)==0x0c0000) { // 0c0000-0dffff if ((a&0xfe0000)==0x0c0000 && (Pico_mcd->s68k_regs[3]&4)) { // 0c0000-0dffff
int bank; int bank;
wrdprintf("s68k_wram1M r8: [%06x] @%06x", a, SekPcS68k); wrdprintf("s68k_wram1M r8: [%06x] @%06x", a, SekPcS68k);
if (!(Pico_mcd->s68k_regs[3]&4)) // if (!(Pico_mcd->s68k_regs[3]&4))
dprintf("s68k_wram1M FIXME: wrong mode"); // dprintf("s68k_wram1M FIXME: wrong mode");
bank = !(Pico_mcd->s68k_regs[3]&1); bank = !(Pico_mcd->s68k_regs[3]&1);
d = Pico_mcd->word_ram1M[bank][(a^1)&0x1ffff]; d = Pico_mcd->word_ram1M[bank][(a^1)&0x1ffff];
wrdprintf("ret = %02x", (u8)d); wrdprintf("ret = %02x", (u8)d);
@ -781,11 +782,11 @@ u16 PicoReadS68k16(u32 a)
} }
// word RAM (1M area) // word RAM (1M area)
if ((a&0xfe0000)==0x0c0000) { // 0c0000-0dffff if ((a&0xfe0000)==0x0c0000 && (Pico_mcd->s68k_regs[3]&4)) { // 0c0000-0dffff
int bank; int bank;
wrdprintf("s68k_wram1M r16: [%06x] @%06x", a, SekPcS68k); wrdprintf("s68k_wram1M r16: [%06x] @%06x", a, SekPcS68k);
if (!(Pico_mcd->s68k_regs[3]&4)) // if (!(Pico_mcd->s68k_regs[3]&4))
dprintf("s68k_wram1M FIXME: wrong mode"); // dprintf("s68k_wram1M FIXME: wrong mode");
bank = !(Pico_mcd->s68k_regs[3]&1); bank = !(Pico_mcd->s68k_regs[3]&1);
d = *(u16 *)(Pico_mcd->word_ram1M[bank]+(a&0x1fffe)); d = *(u16 *)(Pico_mcd->word_ram1M[bank]+(a&0x1fffe));
wrdprintf("ret = %04x", d); wrdprintf("ret = %04x", d);
@ -871,11 +872,11 @@ u32 PicoReadS68k32(u32 a)
} }
// word RAM (1M area) // word RAM (1M area)
if ((a&0xfe0000)==0x0c0000) { // 0c0000-0dffff if ((a&0xfe0000)==0x0c0000 && (Pico_mcd->s68k_regs[3]&4)) { // 0c0000-0dffff
int bank; int bank;
wrdprintf("s68k_wram1M r32: [%06x] @%06x", a, SekPcS68k); wrdprintf("s68k_wram1M r32: [%06x] @%06x", a, SekPcS68k);
if (!(Pico_mcd->s68k_regs[3]&4)) // if (!(Pico_mcd->s68k_regs[3]&4))
dprintf("s68k_wram1M FIXME: wrong mode"); // dprintf("s68k_wram1M FIXME: wrong mode");
bank = !(Pico_mcd->s68k_regs[3]&1); bank = !(Pico_mcd->s68k_regs[3]&1);
u16 *pm=(u16 *)(Pico_mcd->word_ram1M[bank]+(a&0x1fffe)); d = (pm[0]<<16)|pm[1]; u16 *pm=(u16 *)(Pico_mcd->word_ram1M[bank]+(a&0x1fffe)); d = (pm[0]<<16)|pm[1];
wrdprintf("ret = %08x", d); wrdprintf("ret = %08x", d);
@ -972,12 +973,13 @@ void PicoWriteS68k8(u32 a,u8 d)
} }
// word RAM (1M area) // word RAM (1M area)
if ((a&0xfe0000)==0x0c0000) { // 0c0000-0dffff if ((a&0xfe0000)==0x0c0000 && (Pico_mcd->s68k_regs[3]&4)) { // 0c0000-0dffff
// Wing Commander tries to write here in wrong mode
int bank; int bank;
if (d) if (d)
wrdprintf("s68k_wram1M w8: [%06x] %02x @%06x", a, d, SekPcS68k); wrdprintf("s68k_wram1M w8: [%06x] %02x @%06x", a, d, SekPcS68k);
if (!(Pico_mcd->s68k_regs[3]&4)) // if (!(Pico_mcd->s68k_regs[3]&4))
dprintf("s68k_wram1M FIXME: wrong mode"); // dprintf("s68k_wram1M FIXME: wrong mode");
bank = !(Pico_mcd->s68k_regs[3]&1); bank = !(Pico_mcd->s68k_regs[3]&1);
*(u8 *)(Pico_mcd->word_ram1M[bank]+((a^1)&0x1ffff))=d; *(u8 *)(Pico_mcd->word_ram1M[bank]+((a^1)&0x1ffff))=d;
return; return;
@ -1051,12 +1053,12 @@ void PicoWriteS68k16(u32 a,u16 d)
} }
// word RAM (1M area) // word RAM (1M area)
if ((a&0xfe0000)==0x0c0000) { // 0c0000-0dffff if ((a&0xfe0000)==0x0c0000 && (Pico_mcd->s68k_regs[3]&4)) { // 0c0000-0dffff
int bank; int bank;
if (d) if (d)
wrdprintf("s68k_wram1M w16: [%06x] %04x @%06x", a, d, SekPcS68k); wrdprintf("s68k_wram1M w16: [%06x] %04x @%06x", a, d, SekPcS68k);
if (!(Pico_mcd->s68k_regs[3]&4)) // if (!(Pico_mcd->s68k_regs[3]&4))
dprintf("s68k_wram1M FIXME: wrong mode"); // dprintf("s68k_wram1M FIXME: wrong mode");
bank = !(Pico_mcd->s68k_regs[3]&1); bank = !(Pico_mcd->s68k_regs[3]&1);
*(u16 *)(Pico_mcd->word_ram1M[bank]+(a&0x1fffe))=d; *(u16 *)(Pico_mcd->word_ram1M[bank]+(a&0x1fffe))=d;
return; return;
@ -1136,13 +1138,13 @@ void PicoWriteS68k32(u32 a,u32 d)
} }
// word RAM (1M area) // word RAM (1M area)
if ((a&0xfe0000)==0x0c0000) { // 0c0000-0dffff if ((a&0xfe0000)==0x0c0000 && (Pico_mcd->s68k_regs[3]&4)) { // 0c0000-0dffff
int bank; int bank;
u16 *pm; u16 *pm;
if (d) if (d)
wrdprintf("s68k_wram1M w32: [%06x] %08x @%06x", a, d, SekPcS68k); wrdprintf("s68k_wram1M w32: [%06x] %08x @%06x", a, d, SekPcS68k);
if (!(Pico_mcd->s68k_regs[3]&4)) // if (!(Pico_mcd->s68k_regs[3]&4))
dprintf("s68k_wram1M FIXME: wrong mode"); // dprintf("s68k_wram1M FIXME: wrong mode");
bank = !(Pico_mcd->s68k_regs[3]&1); bank = !(Pico_mcd->s68k_regs[3]&1);
pm=(u16 *)(Pico_mcd->word_ram1M[bank]+(a&0x1fffe)); pm=(u16 *)(Pico_mcd->word_ram1M[bank]+(a&0x1fffe));
pm[0]=(u16)(d>>16); pm[1]=(u16)d; pm[0]=(u16)(d>>16); pm[1]=(u16)d;

View file

@ -83,6 +83,46 @@ static __inline void SekRunS68k(int cyc)
#endif #endif
} }
#define PS_STEP_M68K 8
#define PS_STEP_S68K 13
static __inline void SekRunPS(int cyc_m68k, int cyc_s68k)
{
int cyc_do_m68k, cyc_do_s68k, it=0;
int cyc_done_m68k=0, cyc_done_s68k=0;
SekCycleAim+=cyc_m68k;
SekCycleAimS68k+=cyc_s68k;
cyc_do_m68k=SekCycleAim-SekCycleCnt;
cyc_do_s68k=SekCycleAimS68k-SekCycleCntS68k;
while (cyc_done_m68k < cyc_do_m68k || cyc_done_s68k < cyc_do_s68k) {
it++;
if (cyc_done_m68k < cyc_do_m68k && it*PS_STEP_M68K > cyc_done_m68k) {
#if defined(EMU_C68K)
PicoCpu.cycles = PS_STEP_M68K;
CycloneRun(&PicoCpu);
cyc_done_m68k += PS_STEP_M68K - PicoCpu.cycles;
#elif defined(EMU_M68K)
m68k_set_context(&PicoM68kCPU);
cyc_done_m68k += m68k_execute(PS_STEP_M68K);
#endif
} //else dprintf("m68k skipping it #%i", it);
if (cyc_done_s68k < cyc_do_s68k && it*PS_STEP_S68K > cyc_done_s68k) {
#if defined(EMU_C68K)
PicoCpuS68k.cycles = PS_STEP_S68K;
CycloneRun(&PicoCpuS68k);
cyc_done_s68k += PS_STEP_S68K - PicoCpuS68k.cycles;
#elif defined(EMU_M68K)
m68k_set_context(&PicoS68kCPU);
cyc_done_s68k += m68k_execute(PS_STEP_S68K);
#endif
} //else dprintf("s68k skipping it #%i", it);
}
SekCycleCnt += cyc_done_m68k;
SekCycleCntS68k += cyc_done_s68k;
//dprintf("== end SekRunPS, it=%i ==", it);
}
static __inline void check_cd_dma(void) static __inline void check_cd_dma(void)
{ {
int ddx; int ddx;
@ -230,23 +270,12 @@ static int PicoFrameHintsMCD(void)
// Run scanline: // Run scanline:
//dprintf("m68k starting exec @ %06x", SekPc); //dprintf("m68k starting exec @ %06x", SekPc);
if(Pico.m.dma_bytes) SekCycleCnt+=CheckDMA(); if(Pico.m.dma_bytes) SekCycleCnt+=CheckDMA();
SekRun(cycles_68k); if((PicoOpt & 0x2000) && (Pico_mcd->m.busreq&3) == 1) {
if ((Pico_mcd->m.busreq&3) == 1) { // no busreq/no reset SekRunPS(cycles_68k, cycles_s68k); // "perfect sync"
#if 0 } else {
int i; SekRun(cycles_68k);
FILE *f = fopen("prg_ram.bin", "wb"); if ((Pico_mcd->m.busreq&3) == 1) // no busreq/no reset
for (i = 0; i < 0x80000; i+=2) SekRunS68k(cycles_s68k);
{
int tmp = Pico_mcd->prg_ram[i];
Pico_mcd->prg_ram[i] = Pico_mcd->prg_ram[i+1];
Pico_mcd->prg_ram[i+1] = tmp;
}
fwrite(Pico_mcd->prg_ram, 1, 0x80000, f);
fclose(f);
exit(1);
#endif
//dprintf("s68k starting exec @ %06x", SekPcS68k);
SekRunS68k(cycles_s68k);
} }
if((PicoOpt&4) && Pico.m.z80Run) { if((PicoOpt&4) && Pico.m.z80Run) {

View file

@ -48,10 +48,11 @@ void pcm_write(unsigned int a, unsigned int d)
void pcm_set_rate(int rate) void pcm_set_rate(int rate)
{ {
double step = 31.8 * 1024.0 / (double) rate; // max <4 @ 8000Hz float step = 31.8 * 1024.0 / (float) rate; // max <4 @ 8000Hz
step *= 256*256/4; step *= 256*256/4;
g_rate = (unsigned int) step; g_rate = (unsigned int) step;
printf("g_rate: %08x\n", g_rate); if (step - (float) g_rate >= 0.5) g_rate++;
printf("g_rate: %f %08x\n", (double)step, g_rate);
} }
@ -82,7 +83,7 @@ void pcm_update(int *buffer, int length, int stereo)
mul_l = ((int)ch->regs[0] * (ch->regs[1] & 0xf)) >> (5+1); // (env * pan) >> 5 mul_l = ((int)ch->regs[0] * (ch->regs[1] & 0xf)) >> (5+1); // (env * pan) >> 5
mul_r = ((int)ch->regs[0] * (ch->regs[1] >> 4)) >> (5+1); mul_r = ((int)ch->regs[0] * (ch->regs[1] >> 4)) >> (5+1);
step = ((unsigned int)(*(unsigned short *)&ch->regs[2]) * g_rate) >> 14; // freq step step = ((unsigned int)(*(unsigned short *)&ch->regs[2]) * g_rate) >> 14; // freq step
// printf("step=%i, cstep=%i, mul_l=%i, mul_r=%i, ch=%i, addr=%x, en=%02x\n", // fprintf(stderr, "step=%i, cstep=%i, mul_l=%i, mul_r=%i, ch=%i, addr=%x, en=%02x\n",
// *(unsigned short *)&ch->regs[2], step, mul_l, mul_r, i, addr, Pico_mcd->pcm.enabled); // *(unsigned short *)&ch->regs[2], step, mul_l, mul_r, i, addr, Pico_mcd->pcm.enabled);
if (!stereo && mul_l < mul_r) mul_l = mul_r; if (!stereo && mul_l < mul_r) mul_l = mul_r;

View file

@ -424,8 +424,6 @@ static void romfname_ext(char *dst, const char *prefix, const char *ext)
dst[511-8] = 0; dst[511-8] = 0;
if (dst[strlen(dst)-4] == '.') dst[strlen(dst)-4] = 0; if (dst[strlen(dst)-4] == '.') dst[strlen(dst)-4] = 0;
if (ext) strcat(dst, ext); if (ext) strcat(dst, ext);
printf("romfname_ext: %s\n", dst);
} }
@ -973,9 +971,9 @@ void emu_forced_frame(void)
PicoOpt = po_old; PicoOpt = po_old;
if (!(Pico.video.reg[12]&1)) { if (!(Pico.video.reg[12]&1)) {
vidCpyM2 = vidCpyM2_40col; vidCpyM2 = vidCpyM2_32col;
clearArea(1); clearArea(1);
} else vidCpyM2 = vidCpyM2_32col; } else vidCpyM2 = vidCpyM2_40col;
vidCpyM2((unsigned char *)gp2x_screen+320*8, framebuff+328*8); vidCpyM2((unsigned char *)gp2x_screen+320*8, framebuff+328*8);
vidConvCpyRGB32(localPal, Pico.cram, 0x40); vidConvCpyRGB32(localPal, Pico.cram, 0x40);
@ -1369,8 +1367,10 @@ int emu_SaveLoadGame(int load, int sram)
// make save filename // make save filename
saveFname = emu_GetSaveFName(load, sram, state_slot); saveFname = emu_GetSaveFName(load, sram, state_slot);
if (saveFname == NULL) { if (saveFname == NULL) {
strcpy(noticeMsg, load ? "LOAD FAILED (missing file)" : "SAVE FAILED "); if (!sram) {
gettimeofday(&noticeMsgTime, 0); strcpy(noticeMsg, load ? "LOAD FAILED (missing file)" : "SAVE FAILED ");
gettimeofday(&noticeMsgTime, 0);
}
return -1; return -1;
} }

View file

@ -688,9 +688,10 @@ static void draw_cd_menu_options(int menu_sel, char *b_us, char *b_eu, char *b_j
gp2x_text_out8(tl_x, y, "USA BIOS: %s", b_us); // 0 gp2x_text_out8(tl_x, y, "USA BIOS: %s", b_us); // 0
gp2x_text_out8(tl_x, (y+=10), "EUR BIOS: %s", b_eu); // 1 gp2x_text_out8(tl_x, (y+=10), "EUR BIOS: %s", b_eu); // 1
gp2x_text_out8(tl_x, (y+=10), "JAP BIOS: %s", b_jp); // 2 gp2x_text_out8(tl_x, (y+=10), "JAP BIOS: %s", b_jp); // 2
gp2x_text_out8(tl_x, (y+=10), "CD LEDs %s", (currentConfig.EmuOpt &0x400)?"ON":"OFF"); // 3 gp2x_text_out8(tl_x, (y+=10), "CD LEDs %s", (currentConfig.EmuOpt &0x0400)?"ON":"OFF"); // 3
gp2x_text_out8(tl_x, (y+=10), "CDDA audio (using mp3s) %s", (currentConfig.PicoOpt&0x800)?"ON":"OFF"); // 4 gp2x_text_out8(tl_x, (y+=10), "CDDA audio (using mp3s) %s", (currentConfig.PicoOpt&0x0800)?"ON":"OFF"); // 4
gp2x_text_out8(tl_x, (y+=10), "PCM audio %s", (currentConfig.PicoOpt&0x400)?"ON":"OFF"); // 5 gp2x_text_out8(tl_x, (y+=10), "PCM audio %s", (currentConfig.PicoOpt&0x0400)?"ON":"OFF"); // 5
gp2x_text_out8(tl_x, (y+=10), "Better sync (very slow) %s", (currentConfig.PicoOpt&0x2000)?"ON":"OFF"); // 6
gp2x_text_out8(tl_x, (y+=10), "Done"); gp2x_text_out8(tl_x, (y+=10), "Done");
// draw cursor // draw cursor
@ -706,7 +707,7 @@ static void draw_cd_menu_options(int menu_sel, char *b_us, char *b_eu, char *b_j
static void cd_menu_loop_options(void) static void cd_menu_loop_options(void)
{ {
int menu_sel = 0, menu_sel_max = 6; int menu_sel = 0, menu_sel_max = 7;
unsigned long inp = 0; unsigned long inp = 0;
char bios_us[32], bios_eu[32], bios_jp[32], *bios, *p; char bios_us[32], bios_eu[32], bios_jp[32], *bios, *p;
@ -733,10 +734,11 @@ static void cd_menu_loop_options(void)
if(inp & GP2X_DOWN) { menu_sel++; if (menu_sel > menu_sel_max) menu_sel = 0; } if(inp & GP2X_DOWN) { menu_sel++; if (menu_sel > menu_sel_max) menu_sel = 0; }
if((inp& GP2X_B)||(inp&GP2X_LEFT)||(inp&GP2X_RIGHT)) { // toggleable options if((inp& GP2X_B)||(inp&GP2X_LEFT)||(inp&GP2X_RIGHT)) { // toggleable options
switch (menu_sel) { switch (menu_sel) {
case 3: currentConfig.EmuOpt ^=0x400; break; case 3: currentConfig.EmuOpt ^=0x0400; break;
case 4: currentConfig.PicoOpt^=0x800; break; case 4: currentConfig.PicoOpt^=0x0800; break;
case 5: currentConfig.PicoOpt^=0x400; break; case 5: currentConfig.PicoOpt^=0x0400; break;
case 6: return; case 6: currentConfig.PicoOpt^=0x2000; break;
case 7: return;
} }
} }
if(inp & (GP2X_X|GP2X_A)) return; if(inp & (GP2X_X|GP2X_A)) return;

View file

@ -1,2 +1,2 @@
#define VERSION "1.15" #define VERSION "1.20"

View file

@ -260,6 +260,11 @@ void gp2x_video_RGB_setscaling(int W, int H)
{ {
} }
void gp2x_memcpy_buffers(int buffers, void *data, int offset, int len)
{
memcpy((char *)gp2x_screen + offset, data, len);
}
void gp2x_memcpy_all_buffers(void *data, int offset, int len) void gp2x_memcpy_all_buffers(void *data, int offset, int len)
{ {
memcpy((char *)gp2x_screen + offset, data, len); memcpy((char *)gp2x_screen + offset, data, len);