From 672ad671130bb662f099b790fdaef4be85e6c146 Mon Sep 17 00:00:00 2001 From: notaz Date: Tue, 2 Jan 2007 22:17:05 +0000 Subject: [PATCH] mcd: text shows up git-svn-id: file:///home/notaz/opt/svn/PicoDrive@14 be3aeb3a-fb24-0410-a615-afba39da0efa --- Pico/Pico.c | 2 +- Pico/VideoPort.c | 57 +++++---------- Pico/cd/LC89510.c | 2 +- Pico/cd/Memory.c | 135 +++++++++++++++++++++++++++-------- Pico/cd/Pico.c | 15 ++-- Pico/cd/Sek.c | 2 +- cpu/musashi/m68kcpu.c | 12 ++-- cpu/musashi/m68kcpu.h | 5 +- platform/gp2x/Makefile | 11 ++- platform/gp2x/emu.c | 12 ++-- platform/gp2x/menu.c | 8 +-- platform/gp2x/version.h | 2 +- platform/linux/port_config.h | 2 +- 13 files changed, 165 insertions(+), 100 deletions(-) diff --git a/Pico/Pico.c b/Pico/Pico.c index b430d661..90b06d6e 100644 --- a/Pico/Pico.c +++ b/Pico/Pico.c @@ -23,7 +23,7 @@ struct PicoSRAM SRam; int z80startCycle = 0, z80stopCycle = 0; // in 68k cycles //int z80ExtraCycles = 0; int PicoPad[2]; // Joypads, format is SACB RLDU -int PicoMCD = 0; // mega CD status +int PicoMCD = 1; // mega CD status: scd_started // to be called once on emu init int PicoInit(void) diff --git a/Pico/VideoPort.c b/Pico/VideoPort.c index 75267c35..527f2f03 100644 --- a/Pico/VideoPort.c +++ b/Pico/VideoPort.c @@ -58,26 +58,6 @@ static unsigned int VideoRead() return d; } -#if 0 -// calculate the number of cycles 68k->VDP dma operation would take -static int DmaSlowBurn(int len) -{ - // test: Legend of Galahad, Time Killers - int burn,maxlen,line=Pico.m.scanline; - - if(line == -1) line=vcounts[SekCyclesDone()>>8]; - maxlen=(224-line)*18; - if(len <= maxlen) - burn = len*(((488<<8)/18))>>8; - else { - burn = maxlen*(((488<<8)/18))>>8; - burn += (len-maxlen)*(((488<<8)/180))>>8; - } - - return burn; -} -#endif - static int GetDmaLength() { struct PicoVideo *pvid=&Pico.video; @@ -95,7 +75,7 @@ static void DmaSlow(int len) u16 *pd=0, *pdend, *r; unsigned int a=Pico.video.addr, a2, d; unsigned char inc=Pico.video.reg[0xf]; - unsigned int source; // , burn; + unsigned int source; source =Pico.video.reg[0x15]<<1; source|=Pico.video.reg[0x16]<<9; @@ -105,27 +85,22 @@ static void DmaSlow(int len) Pico.video.type, source, a, len, inc, (Pico.video.status&8)||!(Pico.video.reg[1]&0x40), Pico.m.scanline, SekCyclesDone(), SekPc); + if(Pico.m.scanline != -1) { + Pico.m.dma_bytes += len; + SekSetCyclesLeft(SekCyclesLeft - CheckDMA()); + } else { + // be approximate in non-accurate mode + SekSetCyclesLeft(SekCyclesLeft - (len*(((488<<8)/167))>>8)); + } + if ((source&0xe00000)==0xe00000) { pd=(u16 *)(Pico.ram+(source&0xfffe)); pdend=(u16 *)(Pico.ram+0x10000); } // Ram - else if(source>8); // very approximate - if(!(Pico.video.status&8)) burn+=burn>>1; // a hack for Legend of Galahad - } else burn = DmaSlowBurn(len); - SekCyclesBurn(burn); -#else - Pico.m.dma_bytes += len; -#endif - //if(!(Pico.video.status&8)) -// SekEndRun(0); - //Pico.m.dma_endcycles = 0;//SekCyclesLeft; - //Pico.m.dma_endcycles -= Pico.m.dma_endcycles>>3; // hack - SekSetCyclesLeft(SekCyclesLeft - CheckDMA()); -// CheckDMA(); -// dprintf("DmaSlow burn: %i @ %06x", burn, SekPc); + else if(PicoMCD & 1) { + if(source<0x20000) { pd=(u16 *)(Pico_mcd->bios+(source&~1)); pdend=(u16 *)(Pico_mcd->bios+0x20000); } // Bios area + else { dprintf("unsupported src"); return; } // Invalid source address + } else { + if(sourcecdd.Ext; Pico_mcd->s68k_regs[0x38+9] = ~csum & 0xf; - Pico_mcd->s68k_regs[0x36] &= 3; // CDD.Control + Pico_mcd->s68k_regs[0x37] &= 3; // CDD.Control if (Pico_mcd->s68k_regs[0x33] & (1<<4)) { diff --git a/Pico/cd/Memory.c b/Pico/cd/Memory.c index a1cadb1f..cbaeb9d4 100644 --- a/Pico/cd/Memory.c +++ b/Pico/cd/Memory.c @@ -34,11 +34,14 @@ static u32 m68k_reg_read16(u32 a, int realsize) { u32 d=0; a &= 0x3e; - dprintf("m68k_regs r%2i: [%02x] @%06x", realsize&~1, a+(realsize&1), SekPc); + // dprintf("m68k_regs r%2i: [%02x] @%06x", realsize&~1, a+(realsize&1), SekPc); switch (a) { + case 0: + d = ((Pico_mcd->s68k_regs[0x33]<<13)&0x8000) | Pico_mcd->m68k_regs[1]; // here IFL2 is always 0, just like in Gens + goto end; case 2: - d = (Pico_mcd->m68k_regs[a]<<8) | Pico_mcd->m68k_regs[a+1] | 1; // for now 2M to m68k + d = (Pico_mcd->s68k_regs[a]<<8) | (Pico_mcd->s68k_regs[a+1]&0xc7); goto end; case 8: dprintf("m68k host data read"); @@ -64,54 +67,66 @@ static u32 m68k_reg_read16(u32 a, int realsize) end: - dprintf("ret = %04x", d); + // dprintf("ret = %04x", d); return d; } static void m68k_reg_write8(u32 a, u32 d, int realsize) { a &= 0x3f; - dprintf("m68k_regs w%2i: [%02x] %02x @%06x", realsize, a, d, SekPc); + // dprintf("m68k_regs w%2i: [%02x] %02x @%06x", realsize, a, d, SekPc); switch (a) { case 0: + d &= 1; if ((d&1) && (Pico_mcd->s68k_regs[0x33]&(1<<2))) { dprintf("m68k: s68k irq 2"); SekInterruptS68k(2); } break; case 1: + d &= 3; if (!(d&1)) PicoMCD |= 2; // reset pending, needed to be sure we fetch the right vectors on reset if ( (Pico_mcd->m68k_regs[1]&1) != (d&1)) dprintf("m68k: s68k reset %i", !(d&1)); if ( (Pico_mcd->m68k_regs[1]&2) != (d&2)) dprintf("m68k: s68k brq %i", (d&2)>>1); if (/*!(Pico_mcd->m68k_regs[1]&1) &&*/ (PicoMCD&2) && (d&3)==1) { SekResetS68k(); // S68k comes out of RESET or BRQ state PicoMCD&=~2; - dprintf("m68k: resetting s68k"); + dprintf("m68k: resetting s68k, cycles=%i", SekCyclesLeft); } break; + case 2: + Pico_mcd->s68k_regs[2] = d; // really use s68k side register + return; case 3: - if ((Pico_mcd->m68k_regs[3]>>6) != ((d>>6)&3)) - dprintf("m68k: prg bank: %i -> %i", (Pico_mcd->m68k_regs[a]>>6), ((d>>6)&3)); - if ((Pico_mcd->m68k_regs[3]&4) != (d&4)) dprintf("m68k: ram mode %i mbit", (d&4) ? 1 : 2); - if ((Pico_mcd->m68k_regs[3]&2) != (d&2)) dprintf("m68k: %s", (d&4) ? ((d&2) ? "word swap req" : "noop?") : - ((d&2) ? "word ram to s68k" : "word ram to m68k")); - break; + d &= 0xc2; + if ((Pico_mcd->s68k_regs[3]>>6) != ((d>>6)&3)) + dprintf("m68k: prg bank: %i -> %i", (Pico_mcd->s68k_regs[a]>>6), ((d>>6)&3)); + //if ((Pico_mcd->s68k_regs[3]&4) != (d&4)) dprintf("m68k: ram mode %i mbit", (d&4) ? 1 : 2); + //if ((Pico_mcd->s68k_regs[3]&2) != (d&2)) dprintf("m68k: %s", (d&4) ? ((d&2) ? "word swap req" : "noop?") : + // ((d&2) ? "word ram to s68k" : "word ram to m68k")); + d |= Pico_mcd->s68k_regs[3]&0x1d; + if (d & 2) d &= ~1; // returning word RAM to s68k + Pico_mcd->s68k_regs[3] = d; // really use s68k side register + return; case 0xe: - dprintf("m68k: comm flag: %02x", d); + //dprintf("m68k: comm flag: %02x", d); - dprintf("s68k @ %06x", SekPcS68k); + //dprintf("s68k @ %06x", SekPcS68k); Pico_mcd->s68k_regs[0xe] = d; break; } - if ((a&0xff) == 0x10) { + if (a < 0x10) { + Pico_mcd->m68k_regs[a] = (u8) d; + return; + } + + if ((a&0xf0) == 0x10) { Pico_mcd->s68k_regs[a] = d; + return; } if (a >= 0x20 || (a >= 0xa && a <= 0xd) || a == 0x0f) dprintf("m68k: invalid write?"); - - if (a < 0x10) - Pico_mcd->m68k_regs[a] = (u8) d; } @@ -121,11 +136,14 @@ static u32 s68k_reg_read16(u32 a, int realsize) u32 d=0; a &= 0x1fe; - dprintf("s68k_regs r%2i: [%02x] @ %06x", realsize&~1, a+(realsize&1), SekPcS68k); + // dprintf("s68k_regs r%2i: [%02x] @ %06x", realsize&~1, a+(realsize&1), SekPcS68k); switch (a) { case 0: d = 1; goto end; // ver = 0, not in reset state + case 2: + d = (Pico_mcd->s68k_regs[a]<<8) | (Pico_mcd->s68k_regs[a+1]&0x1f); + goto end; case 6: d = CDC_Read_Reg(); goto end; @@ -145,7 +163,7 @@ static u32 s68k_reg_read16(u32 a, int realsize) end: - dprintf("ret = %04x", d); + // dprintf("ret = %04x", d); return d; } @@ -153,10 +171,17 @@ end: static void s68k_reg_write8(u32 a, u32 d, int realsize) { a &= 0x1ff; - dprintf("s68k_regs w%2i: [%02x] %02x @ %06x", realsize, a, d, SekPcS68k); + //dprintf("s68k_regs w%2i: [%02x] %02x @ %06x", realsize, a, d, SekPcS68k); // TODO: review against Gens switch (a) { + case 2: + return; // only m68k can change WP + case 3: + d &= 0x1d; + d |= Pico_mcd->s68k_regs[3]&0xc2; + if (d&1) d &= ~2; // returning word RAM to m68k + break; case 4: dprintf("s68k CDC dest: %x", d&7); Pico_mcd->s68k_regs[4] = (Pico_mcd->s68k_regs[4]&0xC0) | (d&7); // CDC mode @@ -180,12 +205,17 @@ static void s68k_reg_write8(u32 a, u32 d, int realsize) case 0x34: // fader Pico_mcd->s68k_regs[a] = (u8) d & 0x7f; return; - case 0x37: - if ((d&4) && !(Pico_mcd->s68k_regs[0x37]&4)) { + case 0x36: + return; // d/m bit is unsetable + case 0x37: { + u32 d_old = Pico_mcd->s68k_regs[0x37]; + Pico_mcd->s68k_regs[0x37] = d&7; + if ((d&4) && !(d_old&4)) { CDD_Export_Status(); // counter75hz = 0; // ??? } - break; + return; + } case 0x4b: Pico_mcd->s68k_regs[a] = (u8) d; CDD_Import_Command(); @@ -302,7 +332,10 @@ static u32 OtherRead16(u32 a, int realsize) if ((a&0xe700e0)==0xc00000) { d=PicoVideoRead(a); goto end; } - if ((a&0xffffc0)==0xa12000) { d=m68k_reg_read16(a, realsize); goto end; } + if ((a&0xffffc0)==0xa12000) { + d=m68k_reg_read16(a, realsize); + goto end; + } d = UnusualRead16(a, realsize); @@ -410,15 +443,21 @@ u8 PicoReadM68k8(u32 a) // prg RAM if ((a&0xfe0000)==0x020000) { - u8 *prg_bank = Pico_mcd->prg_ram_b[Pico_mcd->m68k_regs[3]>>6]; + u8 *prg_bank = Pico_mcd->prg_ram_b[Pico_mcd->s68k_regs[3]>>6]; d = *(prg_bank+((a^1)&0x1ffff)); goto end; } if ((a&0xff4000)==0xa00000) { d=z80Read8(a); goto end; } // Z80 Ram + if ((a&0xffffc0)==0xa12000) + dprintf("m68k_regs r8: [%02x] @%06x", a&0x3f, SekPc); + d=OtherRead16(a&~1, 8|(a&1)); if ((a&1)==0) d>>=8; + if ((a&0xffffc0)==0xa12000) + dprintf("ret = %02x", (u8)d); + end: #ifdef __debug_io @@ -439,13 +478,19 @@ u16 PicoReadM68k16(u32 a) // prg RAM if ((a&0xfe0000)==0x020000) { - u8 *prg_bank = Pico_mcd->prg_ram_b[Pico_mcd->m68k_regs[3]>>6]; + u8 *prg_bank = Pico_mcd->prg_ram_b[Pico_mcd->s68k_regs[3]>>6]; d = *(u16 *)(prg_bank+(a&0x1fffe)); goto end; } + if ((a&0xffffc0)==0xa12000) + dprintf("m68k_regs r16: [%02x] @%06x", a&0x3f, SekPc); + d = (u16)OtherRead16(a, 16); + if ((a&0xffffc0)==0xa12000) + dprintf("ret = %04x", d); + end: #ifdef __debug_io @@ -466,14 +511,20 @@ u32 PicoReadM68k32(u32 a) // prg RAM if ((a&0xfe0000)==0x020000) { - u8 *prg_bank = Pico_mcd->prg_ram_b[Pico_mcd->m68k_regs[3]>>6]; + u8 *prg_bank = Pico_mcd->prg_ram_b[Pico_mcd->s68k_regs[3]>>6]; u16 *pm=(u16 *)(prg_bank+(a&0x1fffe)); d = (pm[0]<<16)|pm[1]; goto end; } + if ((a&0xffffc0)==0xa12000) + dprintf("m68k_regs r32: [%02x] @%06x", a&0x3f, SekPc); + d = (OtherRead16(a, 32)<<16)|OtherRead16(a+2, 32); + if ((a&0xffffc0)==0xa12000) + dprintf("ret = %08x", d); + end: #ifdef __debug_io dprintf("r32: %06x, %08x @%06x", a&0xffffff, d, SekPc); @@ -499,12 +550,15 @@ void PicoWriteM68k8(u32 a,u8 d) // prg RAM if ((a&0xfe0000)==0x020000) { - u8 *prg_bank = Pico_mcd->prg_ram_b[Pico_mcd->m68k_regs[3]>>6]; + u8 *prg_bank = Pico_mcd->prg_ram_b[Pico_mcd->s68k_regs[3]>>6]; u8 *pm=(u8 *)(prg_bank+((a^1)&0x1ffff)); *pm=d; return; } + if ((a&0xffffc0)==0xa12000) + dprintf("m68k_regs w8: [%02x] %02x @%06x", a&0x3f, d, SekPc); + OtherWrite8(a,d,8); } @@ -522,11 +576,13 @@ void PicoWriteM68k16(u32 a,u16 d) // prg RAM if ((a&0xfe0000)==0x020000) { - u8 *prg_bank = Pico_mcd->prg_ram_b[Pico_mcd->m68k_regs[3]>>6]; + u8 *prg_bank = Pico_mcd->prg_ram_b[Pico_mcd->s68k_regs[3]>>6]; *(u16 *)(prg_bank+(a&0x1fffe))=d; return; } + if ((a&0xffffc0)==0xa12000) + dprintf("m68k_regs w16: [%02x] %04x @%06x", a&0x3f, d, SekPc); OtherWrite16(a,d); } @@ -549,12 +605,19 @@ void PicoWriteM68k32(u32 a,u32 d) // prg RAM if ((a&0xfe0000)==0x020000) { - u8 *prg_bank = Pico_mcd->prg_ram_b[Pico_mcd->m68k_regs[3]>>6]; + u8 *prg_bank = Pico_mcd->prg_ram_b[Pico_mcd->s68k_regs[3]>>6]; u16 *pm=(u16 *)(prg_bank+(a&0x1fffe)); pm[0]=(u16)(d>>16); pm[1]=(u16)d; return; } + // word RAM + if (a!=0x200000 && (a&0xfc0000)==0x200000) // tmp hack + return; + + + if ((a&0xffffc0)==0xa12000) + dprintf("m68k_regs w32: [%02x] %08x @%06x", a&0x3f, d, SekPc); OtherWrite16(a, (u16)(d>>16)); OtherWrite16(a+2,(u16)d); @@ -578,7 +641,9 @@ u8 PicoReadS68k8(u32 a) // regs if ((a&0xfffe00) == 0xff8000) { + dprintf("s68k_regs r8: [%02x] @ %06x", a&0x1ff, SekPcS68k); d = s68k_reg_read16(a&~1, 8|(a&1)); if ((a&1)==0) d>>=8; + dprintf("ret = %02x", (u8)d); goto end; } @@ -606,7 +671,9 @@ u16 PicoReadS68k16(u32 a) // regs if ((a&0xfffe00) == 0xff8000) { + dprintf("s68k_regs r16: [%02x] @ %06x", a&0x1fe, SekPcS68k); d = s68k_reg_read16(a, 16); + dprintf("ret = %04x", d); goto end; } @@ -635,7 +702,9 @@ u32 PicoReadS68k32(u32 a) // regs if ((a&0xfffe00) == 0xff8000) { + dprintf("s68k_regs r32: [%02x] @ %06x", a&0x1fe, SekPcS68k); d = (s68k_reg_read16(a, 32)<<16)|s68k_reg_read16(a+2, 32); + dprintf("ret = %08x", d); goto end; } @@ -666,8 +735,12 @@ void PicoWriteS68k8(u32 a,u8 d) return; } + if (a != 0xff0011 && (a&0xff8000) == 0xff0000) // PCM hack + return; + // regs if ((a&0xfffe00) == 0xff8000) { + dprintf("s68k_regs w8: [%02x] %02x @ %06x", a&0x1ff, d, SekPcS68k); s68k_reg_write8(a,d,8); return; } @@ -691,6 +764,7 @@ void PicoWriteS68k16(u32 a,u16 d) // regs if ((a&0xfffe00) == 0xff8000) { + dprintf("s68k_regs w16: [%02x] %04x @ %06x", a&0x1ff, d, SekPcS68k); s68k_reg_write8(a, d>>8, 16); s68k_reg_write8(a+1,d&0xff, 16); return; @@ -716,6 +790,7 @@ void PicoWriteS68k32(u32 a,u32 d) // regs if ((a&0xfffe00) == 0xff8000) { + dprintf("s68k_regs w32: [%02x] %08x @ %06x", a&0x1ff, d, SekPcS68k); s68k_reg_write8(a, d>>24, 32); s68k_reg_write8(a+1,(d>>16)&0xff, 32); s68k_reg_write8(a+2,(d>>8) &0xff, 32); diff --git a/Pico/cd/Pico.c b/Pico/cd/Pico.c index d4560fdc..d9879560 100644 --- a/Pico/cd/Pico.c +++ b/Pico/cd/Pico.c @@ -1,7 +1,7 @@ // This is part of Pico Library // (c) Copyright 2004 Dave, All rights reserved. -// (c) Copyright 2006 notaz, All rights reserved. +// (c) Copyright 2007 notaz, All rights reserved. // Free for non-commercial use. // For commercial use, separate licencing terms must be obtained. @@ -11,7 +11,7 @@ #include "../sound/sound.h" -int counter75hz = 0; +static int counter75hz = 0; // TODO: move 2 context int PicoInitMCD(void) @@ -33,6 +33,7 @@ int PicoResetMCD(int hard) // clear everything except BIOS memset(Pico_mcd->prg_ram, 0, sizeof(mcd_state) - sizeof(Pico_mcd->bios)); PicoMCD |= 2; // s68k reset pending + Pico_mcd->s68k_regs[3] = 1; // 2M word RAM mode with m68k access after reset counter75hz = 0; LC89510_Reset(); @@ -71,7 +72,7 @@ extern unsigned char s68k_regs[0x200]; static int PicoFrameHintsMCD(void) { struct PicoVideo *pv=&Pico.video; - int total_z80=0,lines,y,lines_vis = 224,z80CycleAim = 0,line_sample; + int total_z80=0,lines,y,lines_vis = 224,z80CycleAim = 0,line_sample,counter75hz_lim; const int cycles_68k=488,cycles_z80=228,cycles_s68k=795; // both PAL and NTSC compile to same values int skip=PicoSkipFrame || (PicoOpt&0x10); int hint; // Hint counter @@ -81,11 +82,13 @@ static int PicoFrameHintsMCD(void) //cycles_z80 = (int) ((double) OSC_PAL / 15 / 50 / 312 + 0.4); // 228 lines = 312; // Steve Snake says there are 313 lines, but this seems to also work well line_sample = 68; + counter75hz_lim = 2080; if(pv->reg[1]&8) lines_vis = 240; } else { //cycles_68k = (int) ((double) OSC_NTSC / 7 / 60 / 262 + 0.4); // 488 //cycles_z80 = (int) ((double) OSC_NTSC / 15 / 60 / 262 + 0.4); // 228 lines = 262; + counter75hz_lim = 2096; line_sample = 93; } @@ -160,6 +163,7 @@ static int PicoFrameHintsMCD(void) // Run scanline: //dprintf("m68k starting exec @ %06x", SekPc); + if(Pico.m.dma_bytes) SekCycleCnt+=CheckDMA(); SekRun(cycles_68k); if ((Pico_mcd->m68k_regs[1]&3) == 1) { // no busreq/no reset #if 0 @@ -185,9 +189,8 @@ static int PicoFrameHintsMCD(void) total_z80+=z80_run(z80CycleAim-total_z80); } - // if cdd is on, counter elapsed and irq4 is not masked, do irq4 - if ((Pico_mcd->s68k_regs[0x37]&4) && ++counter75hz > 209 && (Pico_mcd->s68k_regs[0x33]&(1<<4))) { - counter75hz = 0; + if ((counter75hz+=10) >= counter75hz_lim) { + counter75hz -= counter75hz_lim; Check_CD_Command(); } } diff --git a/Pico/cd/Sek.c b/Pico/cd/Sek.c index c9d3737b..e0ea83ab 100644 --- a/Pico/cd/Sek.c +++ b/Pico/cd/Sek.c @@ -22,7 +22,7 @@ m68ki_cpu_core PicoS68kCPU; // Mega CD's CPU #ifdef EMU_M68K int SekIntAckS68k(int level) { - dprintf("s68k: int %i ack [%i|%i]", level, Pico.m.scanline, SekCyclesDone()); + dprintf("s68kACK %i", level); CPU_INT_LEVEL = 0; return M68K_INT_ACK_AUTOVECTOR; } diff --git a/cpu/musashi/m68kcpu.c b/cpu/musashi/m68kcpu.c index b3cd36db..e4212a8a 100644 --- a/cpu/musashi/m68kcpu.c +++ b/cpu/musashi/m68kcpu.c @@ -39,8 +39,8 @@ static const char* copyright_notice = /* ================================= DATA ================================= */ /* ======================================================================== */ -int m68ki_initial_cycles; -int m68ki_remaining_cycles = 0; /* Number of clocks remaining */ +// int m68ki_initial_cycles; // moved to m68k_execute() stack +// int m68ki_remaining_cycles = 0; /* Number of clocks remaining */ uint m68ki_tracing = 0; uint m68ki_address_space; @@ -771,6 +771,8 @@ void m68k_set_cpu_type(unsigned int cpu_type) /* ASG: removed per-instruction interrupt checks */ int m68k_execute(int num_cycles) { + int m68ki_initial_cycles; + /* Make sure we're not stopped */ if(!CPU_STOPPED) { @@ -827,17 +829,19 @@ int m68k_execute(int num_cycles) return num_cycles; } - +#if 0 int m68k_cycles_run(void) { return m68ki_initial_cycles - GET_CYCLES(); } +#endif int m68k_cycles_remaining(void) { return GET_CYCLES(); } +#if 0 /* Change the timeslice */ void m68k_modify_timeslice(int cycles) { @@ -851,7 +855,7 @@ void m68k_end_timeslice(void) m68ki_initial_cycles = GET_CYCLES(); SET_CYCLES(0); } - +#endif /* ASG: rewrote so that the int_level is a mask of the IPL0/IPL1/IPL2 bits */ /* KS: Modified so that IPL* bits match with mask positions in the SR diff --git a/cpu/musashi/m68kcpu.h b/cpu/musashi/m68kcpu.h index 88855956..79a6979c 100644 --- a/cpu/musashi/m68kcpu.h +++ b/cpu/musashi/m68kcpu.h @@ -891,13 +891,16 @@ typedef struct void (*set_fc_callback)(unsigned int new_fc); /* Called when the CPU function code changes */ void (*instr_hook_callback)(void); /* Called every instruction cycle prior to execution */ + sint cyc_remaining_cycles; } m68ki_cpu_core; extern m68ki_cpu_core *m68ki_cpu_p; #define m68ki_cpu (*m68ki_cpu_p) // test -extern sint m68ki_remaining_cycles; +// extern sint m68ki_remaining_cycles; +#define m68ki_remaining_cycles m68ki_cpu_p->cyc_remaining_cycles + extern uint m68ki_tracing; extern uint8 m68ki_shift_8_table[]; extern uint16 m68ki_shift_16_table[]; diff --git a/platform/gp2x/Makefile b/platform/gp2x/Makefile index a524cc0d..fc729b0e 100644 --- a/platform/gp2x/Makefile +++ b/platform/gp2x/Makefile @@ -92,10 +92,15 @@ ifeq "$(up)" "1" @cmd //C copy $@ \\\\10.0.1.2\\gp2x\\mnt\\sd\\games\\PicoDrive\\ endif -up: up940 - @cmd //C copy PicoDrive.gpe \\\\10.0.1.2\\gp2x\\mnt\\sd\\games\\PicoDrive\\ +up: # up940 + @cp -v PicoDrive.gpe /mnt/gp2x/mnt/sd/games/PicoDrive/ + +# @cmd //C copy PicoDrive.gpe \\\\10.0.1.2\\gp2x\\mnt\\sd\\games\\PicoDrive\\ + up940: - @cmd //C copy code940.bin \\\\10.0.1.2\\gp2x\\mnt\\sd\\games\\PicoDrive\\ + @cp -v code940.bin /mnt/gp2x/mnt/sd/games/PicoDrive/ + +# @cmd //C copy code940.bin \\\\10.0.1.2\\gp2x\\mnt\\sd\\games\\PicoDrive\\ testrefr.gpe : test.o gp2x.o asmutils.o @echo $@ diff --git a/platform/gp2x/emu.c b/platform/gp2x/emu.c index 6e0021b1..a90d8503 100644 --- a/platform/gp2x/emu.c +++ b/platform/gp2x/emu.c @@ -79,14 +79,15 @@ static void strlwr(char* string) while ( (*string++ = (char)tolower(*string)) ); } -static int try_rfn_ext(char *ext) +static int try_rfn_cut(void) { FILE *tmp; char *p; - p = romFileName + strlen(romFileName) - 4; - if (p < romFileName) p = romFileName; - strcpy(p, ext); + p = romFileName + strlen(romFileName) - 1; + for (; p > romFileName; p--) + if (*p == '.') break; + *p = 0; if((tmp = fopen(romFileName, "rb"))) { fclose(tmp); @@ -156,8 +157,7 @@ int emu_ReloadRom(void) sprintf(menuErrorMsg, "Invalid GMV file."); return 0; } - dummy = try_rfn_ext(".zip") || try_rfn_ext(".bin") || - try_rfn_ext(".smd") || try_rfn_ext(".gen"); + dummy = try_rfn_cut() || try_rfn_cut(); if (!dummy) { sprintf(menuErrorMsg, "Could't find a ROM for movie."); return 0; diff --git a/platform/gp2x/menu.c b/platform/gp2x/menu.c index 588e0c90..7b18517c 100644 --- a/platform/gp2x/menu.c +++ b/platform/gp2x/menu.c @@ -352,11 +352,11 @@ static char *romsel_loop(char *curr_path) for (;;) { draw_dirlist(curr_path, namelist, n, sel); - inp = wait_for_input(GP2X_UP|GP2X_DOWN|GP2X_LEFT|GP2X_RIGHT|GP2X_B|GP2X_X); + inp = wait_for_input(GP2X_UP|GP2X_DOWN|GP2X_LEFT|GP2X_RIGHT|GP2X_L|GP2X_R|GP2X_B|GP2X_X); if(inp & GP2X_UP ) { sel--; if (sel < 0) sel = n-2; } if(inp & GP2X_DOWN) { sel++; if (sel > n-2) sel = 0; } - if(inp & GP2X_LEFT) { sel-=10; if (sel < 0) sel = 0; } - if(inp & GP2X_RIGHT) { sel+=10; if (sel > n-2) sel = n-2; } + if(inp &(GP2X_LEFT|GP2X_L)) { sel-=10; if (sel < 0) sel = 0; } + if(inp &(GP2X_RIGHT|GP2X_R)) { sel+=10; if (sel > n-2) sel = n-2; } if(inp & GP2X_B) { // enter dir/select again: if (namelist[sel+1]->d_type == DT_REG) { @@ -827,7 +827,7 @@ static void draw_menu_credits(void) int tl_x = 15, tl_y = 70, y; memset(gp2x_screen, 0, 320*240); - gp2x_text_out8(tl_x, 20, "PicoDrive v" VERSION " (c) notaz, 2006"); + gp2x_text_out8(tl_x, 20, "PicoDrive v" VERSION " (c) notaz, 2006,2007"); y = tl_y; gp2x_text_out8(tl_x, y, "Credits:"); gp2x_text_out8(tl_x, (y+=10), "Dave: Cyclone 68000 core,"); diff --git a/platform/gp2x/version.h b/platform/gp2x/version.h index 1331a8aa..8d13814e 100644 --- a/platform/gp2x/version.h +++ b/platform/gp2x/version.h @@ -1,2 +1,2 @@ -#define VERSION "0.964" +#define VERSION "0.965" diff --git a/platform/linux/port_config.h b/platform/linux/port_config.h index be76af41..e5c88bba 100644 --- a/platform/linux/port_config.h +++ b/platform/linux/port_config.h @@ -12,7 +12,7 @@ // pico.c #define CAN_HANDLE_240_LINES 1 -#define dprintf(f,...) printf("%05i: " f "\n",Pico.m.frame_count,##__VA_ARGS__) +#define dprintf(f,...) printf("%05i:%03i: " f "\n",Pico.m.frame_count,Pico.m.scanline,##__VA_ARGS__) //#define dprintf(x...) #endif //PORT_CONFIG_H -- 2.39.5