From 1cd356a33daf2eec34e52c075b06d62866f5fb2f Mon Sep 17 00:00:00 2001 From: notaz Date: Mon, 5 Feb 2007 22:23:19 +0000 Subject: [PATCH] 1.14 release git-svn-id: file:///home/notaz/opt/svn/PicoDrive@29 be3aeb3a-fb24-0410-a615-afba39da0efa --- Pico/VideoPort.c | 1 + Pico/cd/LC89510.c | 30 +++++++++++++++++- Pico/cd/Memory.c | 58 +++++++++++++++++++---------------- Pico/cd/cd_sys.c | 18 +++++------ platform/gp2x/940ctl_ym2612.c | 4 +-- platform/gp2x/emu.c | 2 +- platform/gp2x/version.h | 2 +- 7 files changed, 74 insertions(+), 41 deletions(-) diff --git a/Pico/VideoPort.c b/Pico/VideoPort.c index 0edf1bec..b7a05f05 100644 --- a/Pico/VideoPort.c +++ b/Pico/VideoPort.c @@ -104,6 +104,7 @@ static void DmaSlow(int len) pdend=(u16 *)(Pico_mcd->bios+0x20000); } else if ((source&0xfc0000)==0x200000 && (!(Pico_mcd->s68k_regs[3]&4))) { // Word Ram if (!(Pico_mcd->s68k_regs[3]&4)) { // 2M mode + source -= 2; pd=(u16 *)(Pico_mcd->word_ram+(source&0x3fffe)); pdend=(u16 *)(Pico_mcd->word_ram+0x40000); } else { diff --git a/Pico/cd/LC89510.c b/Pico/cd/LC89510.c index a45bbf72..2549fa8e 100644 --- a/Pico/cd/LC89510.c +++ b/Pico/cd/LC89510.c @@ -114,6 +114,13 @@ void Update_CDC_TRansfer(int which) for (len = length; len > 0; len--, src+=2, dest+=2) *dest = (src[0]<<8) | src[1]; + + { // debug + unsigned char *b1 = Pico_mcd->word_ram + dep; + unsigned char *b2 = (unsigned char *)dest - 8; + dprintf("%02x %02x %02x %02x .. %02x %02x %02x %02x", + b1[0], b1[1], b1[4], b1[5], b2[0], b2[1], b2[4], b2[5]); + } } else { @@ -124,6 +131,13 @@ void Update_CDC_TRansfer(int which) for (len = length; len > 0; len--, src+=2, dest++) *dest = (src[0]<<8) | src[1]; + + { // debug + unsigned char *b1 = Pico_mcd->word_ram + dep; + unsigned char *b2 = (unsigned char *)dest - 4; + dprintf("%02x %02x %02x %02x .. %02x %02x %02x %02x", + b1[0], b1[1], b1[2], b1[3], b2[0], b2[1], b2[2], b2[3]); + } } } else if (which == 4) // PCM RAM @@ -132,7 +146,7 @@ void Update_CDC_TRansfer(int which) dest = (unsigned char *) Ram_PCM; dep = ((DMA_Adr & 0x03FF) << 2) + PCM_Chip.Bank; #else - cdprintf("CD DMA # %04x -> PCD TODO", Pico_mcd->cdc.DAC.N); + cdprintf("CD DMA # %04x -> PCM TODO", Pico_mcd->cdc.DAC.N); #endif } else if (which == 5) // PRG RAM @@ -144,12 +158,26 @@ void Update_CDC_TRansfer(int which) for (len = length; len > 0; len--, src+=2, dest++) *dest = (src[0]<<8) | src[1]; + + { // debug + unsigned char *b1 = Pico_mcd->prg_ram + dep; + unsigned char *b2 = (unsigned char *)dest - 4; + dprintf("%02x %02x %02x %02x .. %02x %02x %02x %02x", + b1[0], b1[1], b1[2], b1[3], b2[0], b2[1], b2[2], b2[3]); + } } length <<= 1; Pico_mcd->cdc.DAC.N = (Pico_mcd->cdc.DAC.N + length) & 0xFFFF; if (Pico_mcd->scd.Status_CDC & 0x08) Pico_mcd->cdc.DBC.N -= length; else Pico_mcd->cdc.DBC.N = 0; + + // update DMA_Adr + length >>= 2; + if (which != 4) length >>= 1; + DMA_Adr += length; + Pico_mcd->s68k_regs[0xA] = DMA_Adr >> 8; + Pico_mcd->s68k_regs[0xB] = DMA_Adr; } diff --git a/Pico/cd/Memory.c b/Pico/cd/Memory.c index ff787b0d..c941806e 100644 --- a/Pico/cd/Memory.c +++ b/Pico/cd/Memory.c @@ -43,7 +43,7 @@ static u32 m68k_reg_read16(u32 a) goto end; case 2: d = (Pico_mcd->s68k_regs[a]<<8) | (Pico_mcd->s68k_regs[a+1]&0xc7); - dprintf("m68k_regs r3: %02x @%06x", (u8)d, SekPc); + dprintf("m68k_regs r3: %02x @%06x", (u8)d, SekPcS68k); goto end; case 4: d = Pico_mcd->s68k_regs[4]<<8; @@ -59,7 +59,8 @@ static u32 m68k_reg_read16(u32 a) goto end; case 0xC: dprintf("m68k stopwatch timer read"); - break; + d = Pico_mcd->m.timer_stopwatch >> 16; + goto end; } if (a < 0x30) { @@ -123,9 +124,6 @@ static void m68k_reg_write8(u32 a, u32 d) return; case 0xe: //dprintf("m68k: comm flag: %02x", d); - - //dprintf("s68k @ %06x", SekPcS68k); - Pico_mcd->s68k_regs[0xe] = d; return; } @@ -218,6 +216,10 @@ static void s68k_reg_write8(u32 a, u32 d) dprintf("s68k set stopwatch timer"); Pico_mcd->m.timer_stopwatch = 0; return; + case 0xe: + Pico_mcd->s68k_regs[0Xf] = (d>>1) | (d<<7); // ror8, Gens note: Dragons lair + Pico_mcd->m.timer_stopwatch = 0; + return; case 0x31: dprintf("s68k set int3 timer: %02x", d); Pico_mcd->m.timer_int3 = d << 16; @@ -247,9 +249,9 @@ static void s68k_reg_write8(u32 a, u32 d) return; } - if ((a&0x1f0) == 0x10 || a == 0x0e || (a >= 0x38 && a < 0x42)) + if ((a&0x1f0) == 0x10 || (a >= 0x38 && a < 0x42)) { - dprintf("m68k: invalid write @ %02x?", a); + dprintf("s68k: invalid write @ %02x?", a); return; } @@ -813,7 +815,7 @@ u8 PicoReadS68k8(u32 a) // word RAM (2M area) if ((a&0xfc0000)==0x080000) { // 080000-0bffff - dprintf("s68k_wram2M r8: [%06x] @%06x", a, SekPc); + dprintf("s68k_wram2M r8: [%06x] @%06x", a, SekPcS68k); if (Pico_mcd->s68k_regs[3]&4) { // 1M mode? // TODO (decode) dprintf("(decode)"); @@ -827,7 +829,7 @@ u8 PicoReadS68k8(u32 a) // word RAM (1M area) if ((a&0xfe0000)==0x0c0000 && (Pico_mcd->s68k_regs[3]&4)) { // 0c0000-0dffff - dprintf("s68k_wram1M r8: [%06x] @%06x", a, SekPc); + dprintf("s68k_wram1M r8: [%06x] @%06x", a, SekPcS68k); a=((a&0x1fffe)<<1)|(a&1); if (!(Pico_mcd->s68k_regs[3]&1)) a+=2; d = Pico_mcd->word_ram[a^1]; @@ -837,7 +839,7 @@ u8 PicoReadS68k8(u32 a) // PCM if ((a&0xff8000)==0xff0000) { - dprintf("s68k_pcm r8: [%06x] @%06x", a, SekPc); + dprintf("s68k_pcm r8: [%06x] @%06x", a, SekPcS68k); a &= 0x7fff; if (a >= 0x2000) d = Pico_mcd->pcm_ram_b[Pico_mcd->pcm.bank][(a>>1)&0xfff]; @@ -892,7 +894,7 @@ u16 PicoReadS68k16(u32 a) // word RAM (2M area) if ((a&0xfc0000)==0x080000) { // 080000-0bffff - dprintf("s68k_wram2M r16: [%06x] @%06x", a, SekPc); + dprintf("s68k_wram2M r16: [%06x] @%06x", a, SekPcS68k); if (Pico_mcd->s68k_regs[3]&4) { // 1M mode? // TODO (decode) dprintf("(decode)"); @@ -906,7 +908,7 @@ u16 PicoReadS68k16(u32 a) // word RAM (1M area) if ((a&0xfe0000)==0x0c0000 && (Pico_mcd->s68k_regs[3]&4)) { // 0c0000-0dffff - dprintf("s68k_wram1M r16: [%06x] @%06x", a, SekPc); + dprintf("s68k_wram1M r16: [%06x] @%06x", a, SekPcS68k); a=((a&0x1fffe)<<1); if (!(Pico_mcd->s68k_regs[3]&1)) a+=2; d = *(u16 *)(Pico_mcd->word_ram+a); @@ -916,7 +918,7 @@ u16 PicoReadS68k16(u32 a) // bram if ((a&0xff0000)==0xfe0000) { - dprintf("s68k_bram r16: [%06x] @%06x", a, SekPc); + dprintf("s68k_bram r16: [%06x] @%06x", a, SekPcS68k); a = (a>>1)&0x1fff; d = Pico_mcd->bram[a++]; // Gens does little endian here, and so do we.. d|= Pico_mcd->bram[a++] << 8; @@ -926,7 +928,7 @@ u16 PicoReadS68k16(u32 a) // PCM if ((a&0xff8000)==0xff0000) { - dprintf("s68k_pcm r16: [%06x] @%06x", a, SekPc); + dprintf("s68k_pcm r16: [%06x] @%06x", a, SekPcS68k); a &= 0x7fff; if (a >= 0x2000) d = Pico_mcd->pcm_ram_b[Pico_mcd->pcm.bank][(a>>1)&0xfff]; @@ -976,7 +978,7 @@ u32 PicoReadS68k32(u32 a) // word RAM (2M area) if ((a&0xfc0000)==0x080000) { // 080000-0bffff - dprintf("s68k_wram2M r32: [%06x] @%06x", a, SekPc); + dprintf("s68k_wram2M r32: [%06x] @%06x", a, SekPcS68k); if (Pico_mcd->s68k_regs[3]&4) { // 1M mode? // TODO (decode) dprintf("(decode)"); @@ -990,7 +992,7 @@ u32 PicoReadS68k32(u32 a) // word RAM (1M area) if ((a&0xfe0000)==0x0c0000 && (Pico_mcd->s68k_regs[3]&4)) { // 0c0000-0dffff - dprintf("s68k_wram1M r32: [%06x] @%06x", a, SekPc); + dprintf("s68k_wram1M r32: [%06x] @%06x", a, SekPcS68k); a=((a&0x1fffe)<<1); if (!(Pico_mcd->s68k_regs[3]&1)) a+=2; d = *(u16 *)(Pico_mcd->word_ram+a) << 16; @@ -1001,7 +1003,7 @@ u32 PicoReadS68k32(u32 a) // PCM if ((a&0xff8000)==0xff0000) { - dprintf("s68k_pcm r32: [%06x] @%06x", a, SekPc); + dprintf("s68k_pcm r32: [%06x] @%06x", a, SekPcS68k); a &= 0x7fff; if (a >= 0x2000) { a >>= 1; @@ -1024,7 +1026,7 @@ u32 PicoReadS68k32(u32 a) // bram if ((a&0xff0000)==0xfe0000) { - dprintf("s68k_bram r32: [%06x] @%06x", a, SekPc); + dprintf("s68k_bram r32: [%06x] @%06x", a, SekPcS68k); a = (a>>1)&0x1fff; d = Pico_mcd->bram[a++] << 16; // middle endian? TODO: verify against Fusion.. d|= Pico_mcd->bram[a++] << 24; @@ -1074,7 +1076,7 @@ void PicoWriteS68k8(u32 a,u8 d) // word RAM (2M area) if ((a&0xfc0000)==0x080000) { // 080000-0bffff - dprintf("s68k_wram2M w8: [%06x] %02x @%06x", a, d, SekPc); + dprintf("s68k_wram2M w8: [%06x] %02x @%06x", a, d, SekPcS68k); if (Pico_mcd->s68k_regs[3]&4) { // 1M mode? // TODO (decode) dprintf("(decode)"); @@ -1088,7 +1090,7 @@ void PicoWriteS68k8(u32 a,u8 d) // word RAM (1M area) if ((a&0xfe0000)==0x0c0000 && (Pico_mcd->s68k_regs[3]&4)) { // 0c0000-0dffff if (d) - dprintf("s68k_wram1M w8: [%06x] %02x @%06x", a, d, SekPc); + dprintf("s68k_wram1M w8: [%06x] %02x @%06x", a, d, SekPcS68k); a=((a&0x1fffe)<<1)|(a&1); if (!(Pico_mcd->s68k_regs[3]&1)) a+=2; *(u8 *)(Pico_mcd->word_ram+(a^1))=d; @@ -1137,6 +1139,10 @@ void PicoWriteS68k16(u32 a,u16 d) if (a >= 0x50 && a < 0x68) gfx_cd_write(a, d); else { + if (a == 0xe) { // special case, 2 byte writes would be handled differently + Pico_mcd->s68k_regs[0xf] = d; + return; + } s68k_reg_write8(a, d>>8); s68k_reg_write8(a+1,d&0xff); } @@ -1145,7 +1151,7 @@ void PicoWriteS68k16(u32 a,u16 d) // word RAM (2M area) if ((a&0xfc0000)==0x080000) { // 080000-0bffff - dprintf("s68k_wram2M w16: [%06x] %04x @%06x", a, d, SekPc); + dprintf("s68k_wram2M w16: [%06x] %04x @%06x", a, d, SekPcS68k); if (Pico_mcd->s68k_regs[3]&4) { // 1M mode? // TODO (decode) dprintf("(decode)"); @@ -1159,7 +1165,7 @@ void PicoWriteS68k16(u32 a,u16 d) // word RAM (1M area) if ((a&0xfe0000)==0x0c0000 && (Pico_mcd->s68k_regs[3]&4)) { // 0c0000-0dffff if (d) - dprintf("s68k_wram1M w16: [%06x] %04x @%06x", a, d, SekPc); + dprintf("s68k_wram1M w16: [%06x] %04x @%06x", a, d, SekPcS68k); a=((a&0x1fffe)<<1); if (!(Pico_mcd->s68k_regs[3]&1)) a+=2; *(u16 *)(Pico_mcd->word_ram+a)=d; @@ -1178,7 +1184,7 @@ void PicoWriteS68k16(u32 a,u16 d) // bram if ((a&0xff0000)==0xfe0000) { - dprintf("s68k_bram w16: [%06x] %04x @%06x", a, d, SekPc); + dprintf("s68k_bram w16: [%06x] %04x @%06x", a, d, SekPcS68k); a = (a>>1)&0x1fff; Pico_mcd->bram[a++] = d; // Gens does little endian here, an so do we.. Pico_mcd->bram[a++] = d >> 8; @@ -1223,7 +1229,7 @@ void PicoWriteS68k32(u32 a,u32 d) // word RAM (2M area) if ((a&0xfc0000)==0x080000) { // 080000-0bffff - dprintf("s68k_wram2M w32: [%06x] %08x @%06x", a, d, SekPc); + dprintf("s68k_wram2M w32: [%06x] %08x @%06x", a, d, SekPcS68k); if (Pico_mcd->s68k_regs[3]&4) { // 1M mode? // TODO (decode) dprintf("(decode)"); @@ -1238,7 +1244,7 @@ void PicoWriteS68k32(u32 a,u32 d) // word RAM (1M area) if ((a&0xfe0000)==0x0c0000 && (Pico_mcd->s68k_regs[3]&4)) { // 0c0000-0dffff if (d) - dprintf("s68k_wram1M w32: [%06x] %08x @%06x", a, d, SekPc); + dprintf("s68k_wram1M w32: [%06x] %08x @%06x", a, d, SekPcS68k); a=((a&0x1fffe)<<1); if (!(Pico_mcd->s68k_regs[3]&1)) a+=2; *(u16 *)(Pico_mcd->word_ram+a) = d>>16; @@ -1263,7 +1269,7 @@ void PicoWriteS68k32(u32 a,u32 d) // bram if ((a&0xff0000)==0xfe0000) { - dprintf("s68k_bram w32: [%06x] %08x @%06x", a, d, SekPc); + dprintf("s68k_bram w32: [%06x] %08x @%06x", a, d, SekPcS68k); a = (a>>1)&0x1fff; Pico_mcd->bram[a++] = d >> 16; // middle endian? verify? Pico_mcd->bram[a++] = d >> 24; diff --git a/Pico/cd/cd_sys.c b/Pico/cd/cd_sys.c index c0199e82..a482b7eb 100644 --- a/Pico/cd/cd_sys.c +++ b/Pico/cd/cd_sys.c @@ -152,17 +152,7 @@ void Check_CD_Command(void) { cdprintf("CHECK CD COMMAND"); - // Check CDD - - if (Pico_mcd->scd.CDD_Complete) - { - Pico_mcd->scd.CDD_Complete = 0; - - CDD_Export_Status(); - } - // Check CDC - if (Pico_mcd->scd.Status_CDC & 1) // CDC is reading data ... { cdprintf("Got a read command"); @@ -179,6 +169,14 @@ void Check_CD_Command(void) else Pico_mcd->scd.File_Add_Delay--; } + // Check CDD + if (Pico_mcd->scd.CDD_Complete) + { + Pico_mcd->scd.CDD_Complete = 0; + + CDD_Export_Status(); + } + if (Pico_mcd->scd.Status_CDD == FAST_FOW) { Pico_mcd->scd.Cur_LBA += 10; diff --git a/platform/gp2x/940ctl_ym2612.c b/platform/gp2x/940ctl_ym2612.c index 3502b82c..1a8160d3 100644 --- a/platform/gp2x/940ctl_ym2612.c +++ b/platform/gp2x/940ctl_ym2612.c @@ -565,7 +565,7 @@ void mp3_start_play(FILE *f, int pos) // pos is 0-1023 { int byte_offs = 0; - if (!(currentConfig.EmuOpt&0x800)) { // cdda disabled? + if (!(PicoOpt&0x800)) { // cdda disabled? return; } @@ -601,7 +601,7 @@ int mp3_get_offset(void) int offs1024 = 0; int cdda_on; - cdda_on = (PicoMCD & 1) && (currentConfig.EmuOpt&0x800) && !(Pico_mcd->s68k_regs[0x36] & 1) && + cdda_on = (PicoMCD & 1) && (PicoOpt&0x800) && !(Pico_mcd->s68k_regs[0x36] & 1) && (Pico_mcd->scd.Status_CDC & 1) && loaded_mp3 && shared_ctl->mp3_offs < shared_ctl->mp3_len; if (cdda_on) { diff --git a/platform/gp2x/emu.c b/platform/gp2x/emu.c index e564dfb7..bbb78b2d 100644 --- a/platform/gp2x/emu.c +++ b/platform/gp2x/emu.c @@ -455,7 +455,7 @@ int emu_ReadConfig(int game) currentConfig.lastRomFile[0] = 0; currentConfig.EmuOpt = 0x1f | 0x400; // | cd_leds currentConfig.PicoOpt = 0x0f | 0xe00; // | use_940 | cd_pcm | cd_cdda - currentConfig.PsndRate = 44100; + currentConfig.PsndRate = 22050; // 44100; currentConfig.PicoRegion = 0; // auto currentConfig.PicoAutoRgnOrder = 0x184; // US, EU, JP currentConfig.Frameskip = -1; // auto diff --git a/platform/gp2x/version.h b/platform/gp2x/version.h index bbb221d0..a4d411f2 100644 --- a/platform/gp2x/version.h +++ b/platform/gp2x/version.h @@ -1,2 +1,2 @@ -#define VERSION "1.10" +#define VERSION "1.14" -- 2.39.5