bugfixes, cd/Memory.s

git-svn-id: file:///home/notaz/opt/svn/PicoDrive@70 be3aeb3a-fb24-0410-a615-afba39da0efa
This commit is contained in:
notaz 2007-03-19 18:55:28 +00:00
parent 66fdc0f0d5
commit 4ff2d52753
14 changed files with 2043 additions and 124 deletions

View file

@ -1,3 +1,5 @@
@ vim:filetype=armasm
@ assembly optimized versions of most funtions from draw2.c
@ this is highly specialized, be careful if changing related C code!

View file

@ -1,3 +1,5 @@
@ vim:filetype=armasm
@ memory handlers with banking support for SSF II - The New Challengers
@ mostly based on Gens code
@ -485,18 +487,20 @@ m_read16_romF: @ 0x780000 - 0x7fffff
m_read16_rom 0xF
m_read16_misc:
mov r1, #16
ldr r2, =OtherRead16
bic r0, r0, #1
bx r2
mov r1, #16
b OtherRead16
@ ldr r2, =OtherRead16
@ bx r2
m_read16_vdp:
tst r0, #0x70000
tsteq r0, #0x000e0
bxne lr @ invalid read
ldr r1, =PicoVideoRead
bic r0, r0, #1
bx r1
b PicoVideoRead
@ ldr r1, =PicoVideoRead
@ bx r1
m_read16_ram:
ldr r1, =Pico
@ -506,10 +510,11 @@ m_read16_ram:
bx lr
m_read16_above_rom:
mov r1, #16
ldr r2, =OtherRead16End
bic r0, r0, #1
bx r2
mov r1, #16
b OtherRead16End
@ ldr r2, =OtherRead16End
@ bx r2
.pool
@ -633,12 +638,10 @@ m_read32_vdp:
tsteq r0, #0x000e0
bxne lr @ invalid read
bic r0, r0, #1
stmfd sp!,{r0,lr}
add r1, r0, #2
stmfd sp!,{r1,lr}
bl PicoVideoRead
mov r1, r0
ldmfd sp!,{r0}
stmfd sp!,{r1}
add r0, r0, #2
swp r0, r0, [sp]
bl PicoVideoRead
ldmfd sp!,{r1,lr}
orr r0, r0, r1, lsl #16

View file

@ -124,7 +124,10 @@ end:
//extern UINT32 mz80GetRegisterValue(void *, UINT32);
static void OtherWrite8(u32 a,u32 d,int realsize)
#ifndef _ASM_CD_MEMORY_C
static
#endif
void OtherWrite8(u32 a,u32 d,int realsize)
{
if ((a&0xe700f9)==0xc00011||(a&0xff7ff9)==0xa07f11) { if(PicoOpt&2) SN76496Write(d); return; } // PSG Sound
if ((a&0xff4000)==0xa00000) { if(!(Pico.m.z80Run&1)) Pico.zram[a&0x1fff]=(u8)d; return; } // Z80 ram
@ -187,7 +190,10 @@ static void OtherWrite8(u32 a,u32 d,int realsize)
}
static void OtherWrite16(u32 a,u32 d)
#ifndef _ASM_CD_MEMORY_C
static
#endif
void OtherWrite16(u32 a,u32 d)
{
if ((a&0xe700e0)==0xc00000) { PicoVideoWrite(a,(u16)d); return; }
if ((a&0xff4000)==0xa00000) { if(!(Pico.m.z80Run&1)) Pico.zram[a&0x1fff]=(u8)(d>>8); return; } // Z80 ram (MSB only)

View file

@ -163,7 +163,7 @@ struct PicoSRAM
unsigned char *data; // actual data
unsigned int start; // start address in 68k address space
unsigned int end;
unsigned char resize; // 1=SRAM size changed and needs to be reallocated on PicoReset
unsigned char resize; // 0c: 1=SRAM size changed and needs to be reallocated on PicoReset
unsigned char reg_back; // copy of Pico.m.sram_reg to set after reset
unsigned char changed;
unsigned char pad;
@ -182,10 +182,10 @@ struct mcd_pcm
unsigned char bank;
int pad1;
struct pcm_chan
struct pcm_chan // 08, size 0x10
{
unsigned char regs[8];
unsigned int addr; // played sample address
unsigned int addr; // .08: played sample address
int pad;
} ch[8];
};
@ -195,24 +195,24 @@ struct mcd_misc
unsigned short hint_vector;
unsigned char busreq;
unsigned char s68k_pend_ints;
unsigned int state_flags; // emu state: reset_pending,
unsigned int state_flags; // 04: emu state: reset_pending,
unsigned int counter75hz;
unsigned short audio_offset; // for savestates: play pointer offset (0-1023)
unsigned short audio_offset; // 0c: for savestates: play pointer offset (0-1023)
unsigned char audio_track; // playing audio track # (zero based)
char pad1;
int timer_int3;
int timer_int3; // 10
unsigned int timer_stopwatch;
int pad[10];
};
typedef struct
{
unsigned char bios[0x20000]; // 128K
union { // 512K
unsigned char bios[0x20000]; // 000000: 128K
union { // 020000: 512K
unsigned char prg_ram[0x80000];
unsigned char prg_ram_b[4][0x20000];
};
union { // 256K
union { // 0a0000: 256K
struct {
unsigned char word_ram2M[0x40000];
unsigned char unused[0x20000];
@ -222,19 +222,19 @@ typedef struct
unsigned char word_ram1M[2][0x20000];
};
};
union { // 64K
union { // 100000: 64K
unsigned char pcm_ram[0x10000];
unsigned char pcm_ram_b[0x10][0x1000];
};
unsigned char bram[0x2000]; // 8K
unsigned char s68k_regs[0x200]; // GA, not CPU regs
struct mcd_pcm pcm;
unsigned char s68k_regs[0x200]; // 110000: GA, not CPU regs
unsigned char bram[0x2000]; // 110200: 8K
struct mcd_misc m; // 112200: misc
struct mcd_pcm pcm; // 112240:
_scd_toc TOC; // not to be saved
CDD cdd;
CDC cdc;
_scd scd;
Rot_Comp rot_comp;
struct mcd_misc m;
} mcd_state;
#define Pico_mcd ((mcd_state *)Pico.rom)
@ -268,6 +268,7 @@ void z80_write16(unsigned short data, unsigned short a);
// cd/Memory.c
void PicoMemSetupCD(void);
void PicoMemResetCD(int r3);
unsigned char PicoReadCD8 (unsigned int a);
unsigned short PicoReadCD16(unsigned int a);
unsigned int PicoReadCD32(unsigned int a);

View file

@ -243,6 +243,9 @@ int PicoCdLoadState(void *file)
/* after load events */
if (Pico_mcd->s68k_regs[3]&4) // 1M mode?
wram_2M_to_1M(Pico_mcd->word_ram2M);
#ifdef _ASM_CD_MEMORY_C
PicoMemResetCD(Pico_mcd->s68k_regs[3]);
#endif
if (Pico_mcd->m.audio_track > 0 && Pico_mcd->m.audio_track < Pico_mcd->TOC.Last_Track)
mp3_start_play(Pico_mcd->TOC.Tracks[Pico_mcd->m.audio_track].F, Pico_mcd->m.audio_offset);
// restore hint vector

View file

@ -19,8 +19,6 @@
#include "gfx_cd.h"
#include "pcm.h"
#include "cell_map.c"
typedef unsigned char u8;
typedef unsigned short u16;
typedef unsigned int u32;
@ -36,6 +34,13 @@ typedef unsigned int u32;
// -----------------------------------------------------------------
#ifndef _ASM_CD_MEMORY_C
void PicoMemResetCD(int r3)
{
}
#endif
#ifndef _ASM_CD_MEMORY_C
static u32 m68k_reg_read16(u32 a)
{
u32 d=0;
@ -63,8 +68,8 @@ static u32 m68k_reg_read16(u32 a)
dprintf("m68k FIXME: reserved read");
goto end;
case 0xC:
dprintf("m68k stopwatch timer read");
d = Pico_mcd->m.timer_stopwatch >> 16;
dprintf("m68k stopwatch timer read (%04x)", d);
goto end;
}
@ -81,8 +86,12 @@ end:
// dprintf("ret = %04x", d);
return d;
}
#endif
static void m68k_reg_write8(u32 a, u32 d)
#ifndef _ASM_CD_MEMORY_C
static
#endif
void m68k_reg_write8(u32 a, u32 d)
{
a &= 0x3f;
// dprintf("m68k_regs w%2i: [%02x] %02x @%06x", realsize, a, d, SekPc);
@ -164,7 +173,10 @@ static void m68k_reg_write8(u32 a, u32 d)
}
static u32 s68k_reg_read16(u32 a)
#ifndef _ASM_CD_MEMORY_C
static
#endif
u32 s68k_reg_read16(u32 a)
{
u32 d=0;
@ -176,7 +188,7 @@ static u32 s68k_reg_read16(u32 a)
goto end;
case 2:
d = (Pico_mcd->s68k_regs[a]<<8) | (Pico_mcd->s68k_regs[a+1]&0x1f);
dprintf("s68k_regs r3: %02x @%06x", (u8)d, SekPc);
dprintf("s68k_regs r3: %02x @%06x", (u8)d, SekPcS68k);
goto end;
case 6:
d = CDC_Read_Reg();
@ -185,11 +197,11 @@ static u32 s68k_reg_read16(u32 a)
d = Read_CDC_Host(1); // Gens returns 0 here on byte reads
goto end;
case 0xC:
dprintf("s68k stopwatch timer read");
d = Pico_mcd->m.timer_stopwatch >> 16;
dprintf("s68k stopwatch timer read (%04x)", d);
goto end;
case 0x30:
dprintf("s68k int3 timer read");
dprintf("s68k int3 timer read (%02x%02x)", Pico_mcd->s68k_regs[30], Pico_mcd->s68k_regs[31]);
break;
case 0x34: // fader
d = 0; // no busy bit
@ -217,7 +229,10 @@ end:
return d;
}
static void s68k_reg_write8(u32 a, u32 d)
#ifndef _ASM_CD_MEMORY_C
static
#endif
void s68k_reg_write8(u32 a, u32 d)
{
//dprintf("s68k_regs w%2i: [%02x] %02x @ %06x", realsize, a, d, SekPcS68k);
@ -229,20 +244,33 @@ static void s68k_reg_write8(u32 a, u32 d)
int dold = Pico_mcd->s68k_regs[3];
dprintf("s68k_regs w3: %02x @%06x", (u8)d, SekPc);
d &= 0x1d;
if (d&4) {
d |= dold&0xc2;
if ((d ^ dold) & 5) d &= ~2; // in case of mode or bank change we clear DMNA (m68k req) bit
if (d&4) {
if ((d ^ dold) & 5) {
d &= ~2; // in case of mode or bank change we clear DMNA (m68k req) bit
#ifdef _ASM_CD_MEMORY_C
PicoMemResetCD(d);
#endif
}
if (!(dold & 4)) {
dprintf("wram mode 2M->1M");
wram_2M_to_1M(Pico_mcd->word_ram2M);
}
} else {
d |= Pico_mcd->s68k_regs[3]&0xc3;
if (d&1) d &= ~2; // return word RAM to m68k in 2M mode
if (dold & 4) {
dprintf("wram mode 1M->2M");
wram_1M_to_2M(Pico_mcd->word_ram2M);
if (!(d&1)) { // it didn't set the ret bit, which means it doesn't want to give WRAM to m68k
d &= ~3;
d |= (dold&1) ? 2 : 1; // then give it to the one which had bank0 in 1M mode
}
wram_1M_to_2M(Pico_mcd->word_ram2M);
#ifdef _ASM_CD_MEMORY_C
PicoMemResetCD(d);
#endif
}
else
d |= dold&1;
if (d&1) d &= ~2; // return word RAM to m68k in 2M mode
}
break;
}
@ -307,7 +335,7 @@ static void s68k_reg_write8(u32 a, u32 d)
}
#ifndef _ASM_CD_MEMORY_C
static u32 OtherRead16End(u32 a, int realsize)
{
u32 d=0;
@ -334,12 +362,17 @@ static void OtherWrite8End(u32 a, u32 d, int realsize)
#undef _ASM_MEMORY_C
#include "../MemoryCmn.c"
#include "cell_map.c"
#endif // !def _ASM_CD_MEMORY_C
// -----------------------------------------------------------------
// Read Rom and read Ram
u8 PicoReadM68k8(u32 a)
//u8 PicoReadM68k8_(u32 a);
#ifdef _ASM_CD_MEMORY_C
u8 PicoReadM68k8(u32 a);
#else
static u8 PicoReadM68k8(u32 a)
{
u32 d=0;
@ -350,28 +383,12 @@ u8 PicoReadM68k8(u32 a)
if (a < 0x20000) { d = *(u8 *)(Pico_mcd->bios+(a^1)); goto end; } // bios
// prg RAM
if ((a&0xfe0000)==0x020000) {
if ((a&0xfe0000)==0x020000 && (Pico_mcd->m.busreq&2)) {
u8 *prg_bank = Pico_mcd->prg_ram_b[Pico_mcd->s68k_regs[3]>>6];
d = *(prg_bank+((a^1)&0x1ffff));
goto end;
}
#if 0
if (a == 0x200000 && SekPc == 0xff0b66 && Pico.m.frame_count > 1000)
{
int i;
FILE *ff;
unsigned short *ram = (unsigned short *) Pico.ram;
// unswap and dump RAM
for (i = 0; i < 0x10000/2; i++)
ram[i] = (ram[i]>>8) | (ram[i]<<8);
ff = fopen("ram.bin", "wb");
fwrite(ram, 1, 0x10000, ff);
fclose(ff);
exit(0);
}
#endif
// word RAM
if ((a&0xfc0000)==0x200000) {
wrdprintf("m68k_wram r8: [%06x] @%06x", a, SekPc);
@ -406,9 +423,13 @@ u8 PicoReadM68k8(u32 a)
#endif
return (u8)d;
}
#endif
u16 PicoReadM68k16(u32 a)
#ifdef _ASM_CD_MEMORY_C
u16 PicoReadM68k16(u32 a);
#else
static u16 PicoReadM68k16(u32 a)
{
u16 d=0;
@ -419,7 +440,7 @@ u16 PicoReadM68k16(u32 a)
if (a < 0x20000) { d = *(u16 *)(Pico_mcd->bios+a); goto end; } // bios
// prg RAM
if ((a&0xfe0000)==0x020000) {
if ((a&0xfe0000)==0x020000 && (Pico_mcd->m.busreq&2)) {
u8 *prg_bank = Pico_mcd->prg_ram_b[Pico_mcd->s68k_regs[3]>>6];
d = *(u16 *)(prg_bank+(a&0x1fffe));
goto end;
@ -457,9 +478,13 @@ u16 PicoReadM68k16(u32 a)
#endif
return d;
}
#endif
u32 PicoReadM68k32(u32 a)
#ifdef _ASM_CD_MEMORY_C
u32 PicoReadM68k32(u32 a);
#else
static u32 PicoReadM68k32(u32 a)
{
u32 d=0;
@ -470,7 +495,7 @@ u32 PicoReadM68k32(u32 a)
if (a < 0x20000) { u16 *pm=(u16 *)(Pico_mcd->bios+a); d = (pm[0]<<16)|pm[1]; goto end; } // bios
// prg RAM
if ((a&0xfe0000)==0x020000) {
if ((a&0xfe0000)==0x020000 && (Pico_mcd->m.busreq&2)) {
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];
@ -514,12 +539,16 @@ u32 PicoReadM68k32(u32 a)
#endif
return d;
}
#endif
// -----------------------------------------------------------------
// Write Ram
void PicoWriteM68k8(u32 a,u8 d)
#ifdef _ASM_CD_MEMORY_C
void PicoWriteM68k8(u32 a,u8 d);
#else
static void PicoWriteM68k8(u32 a,u8 d)
{
#ifdef __debug_io
dprintf("w8 : %06x, %02x @%06x", a&0xffffff, d, SekPc);
@ -536,7 +565,7 @@ void PicoWriteM68k8(u32 a,u8 d)
a&=0xffffff;
// prg RAM
if ((a&0xfe0000)==0x020000) {
if ((a&0xfe0000)==0x020000 && (Pico_mcd->m.busreq&2)) {
u8 *prg_bank = Pico_mcd->prg_ram_b[Pico_mcd->s68k_regs[3]>>6];
*(u8 *)(prg_bank+((a^1)&0x1ffff))=d;
return;
@ -563,9 +592,13 @@ void PicoWriteM68k8(u32 a,u8 d)
OtherWrite8(a,d,8);
}
#endif
void PicoWriteM68k16(u32 a,u16 d)
#ifdef _ASM_CD_MEMORY_C
void PicoWriteM68k16(u32 a,u16 d);
#else
static void PicoWriteM68k16(u32 a,u16 d)
{
#ifdef __debug_io
dprintf("w16: %06x, %04x", a&0xffffff, d);
@ -580,7 +613,7 @@ void PicoWriteM68k16(u32 a,u16 d)
a&=0xfffffe;
// prg RAM
if ((a&0xfe0000)==0x020000) {
if ((a&0xfe0000)==0x020000 && (Pico_mcd->m.busreq&2)) {
u8 *prg_bank = Pico_mcd->prg_ram_b[Pico_mcd->s68k_regs[3]>>6];
*(u16 *)(prg_bank+(a&0x1fffe))=d;
return;
@ -607,9 +640,13 @@ void PicoWriteM68k16(u32 a,u16 d)
OtherWrite16(a,d);
}
#endif
void PicoWriteM68k32(u32 a,u32 d)
#ifdef _ASM_CD_MEMORY_C
void PicoWriteM68k32(u32 a,u32 d);
#else
static void PicoWriteM68k32(u32 a,u32 d)
{
#ifdef __debug_io
dprintf("w32: %06x, %08x", a&0xffffff, d);
@ -626,7 +663,7 @@ void PicoWriteM68k32(u32 a,u32 d)
a&=0xfffffe;
// prg RAM
if ((a&0xfe0000)==0x020000) {
if ((a&0xfe0000)==0x020000 && (Pico_mcd->m.busreq&2)) {
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;
@ -664,12 +701,15 @@ void PicoWriteM68k32(u32 a,u32 d)
OtherWrite16(a, (u16)(d>>16));
OtherWrite16(a+2,(u16)d);
}
#endif
// -----------------------------------------------------------------
u8 PicoReadS68k8(u32 a)
#ifdef _ASM_CD_MEMORY_C
u8 PicoReadS68k8(u32 a);
#else
static u8 PicoReadS68k8(u32 a)
{
u32 d=0;
@ -753,9 +793,14 @@ u8 PicoReadS68k8(u32 a)
#endif
return (u8)d;
}
#endif
u16 PicoReadS68k16(u32 a)
//u16 PicoReadS68k16_(u32 a);
#ifdef _ASM_CD_MEMORY_C
u16 PicoReadS68k16(u32 a);
#else
static u16 PicoReadS68k16(u32 a)
{
u32 d=0;
@ -808,17 +853,17 @@ u16 PicoReadS68k16(u32 a)
// bram
if ((a&0xff0000)==0xfe0000) {
dprintf("s68k_bram r16: [%06x] @%06x", a, SekPcS68k);
dprintf("FIXME: 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;
d|= Pico_mcd->bram[a++] << 8; // This is most likely wrong
dprintf("ret = %04x", d);
goto end;
}
// PCM
if ((a&0xff8000)==0xff0000) {
dprintf("s68k_pcm r16: [%06x] @%06x", a, SekPcS68k);
dprintf("FIXME: 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];
@ -840,9 +885,13 @@ u16 PicoReadS68k16(u32 a)
#endif
return d;
}
#endif
u32 PicoReadS68k32(u32 a)
#ifdef _ASM_CD_MEMORY_C
u32 PicoReadS68k32(u32 a);
#else
static u32 PicoReadS68k32(u32 a)
{
u32 d=0;
@ -898,7 +947,7 @@ u32 PicoReadS68k32(u32 a)
// PCM
if ((a&0xff8000)==0xff0000) {
dprintf("s68k_pcm r32: [%06x] @%06x", a, SekPcS68k);
dprintf("FIXME: s68k_pcm r32: [%06x] @%06x", a, SekPcS68k);
a &= 0x7fff;
if (a >= 0x2000) {
a >>= 1;
@ -921,7 +970,7 @@ u32 PicoReadS68k32(u32 a)
// bram
if ((a&0xff0000)==0xfe0000) {
dprintf("s68k_bram r32: [%06x] @%06x", a, SekPcS68k);
dprintf("FIXME: 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;
@ -940,6 +989,7 @@ u32 PicoReadS68k32(u32 a)
#endif
return d;
}
#endif
/* check: jaguar xj 220 (draws entire world using decode) */
@ -998,7 +1048,10 @@ static void decode_write16(u32 a, u16 d, int r3)
// -----------------------------------------------------------------
void PicoWriteS68k8(u32 a,u8 d)
#ifdef _ASM_CD_MEMORY_C
void PicoWriteS68k8(u32 a,u8 d);
#else
static void PicoWriteS68k8(u32 a,u8 d)
{
#ifdef __debug_io2
dprintf("s68k w8 : %06x, %02x @%06x", a&0xffffff, d, SekPcS68k);
@ -1068,9 +1121,13 @@ void PicoWriteS68k8(u32 a,u8 d)
dprintf("s68k w8 : %06x, %02x @%06x", a&0xffffff, d, SekPcS68k);
}
#endif
void PicoWriteS68k16(u32 a,u16 d)
#ifdef _ASM_CD_MEMORY_C
void PicoWriteS68k16(u32 a,u16 d);
#else
static void PicoWriteS68k16(u32 a,u16 d)
{
#ifdef __debug_io2
dprintf("s68k w16: %06x, %04x @%06x", a&0xffffff, d, SekPcS68k);
@ -1148,9 +1205,13 @@ void PicoWriteS68k16(u32 a,u16 d)
dprintf("s68k w16: %06x, %04x @%06x", a&0xffffff, d, SekPcS68k);
}
#endif
void PicoWriteS68k32(u32 a,u32 d)
#ifdef _ASM_CD_MEMORY_C
void PicoWriteS68k32(u32 a,u32 d);
#else
static void PicoWriteS68k32(u32 a,u32 d)
{
#ifdef __debug_io2
dprintf("s68k w32: %06x, %08x @%06x", a&0xffffff, d, SekPcS68k);
@ -1239,7 +1300,7 @@ void PicoWriteS68k32(u32 a,u32 d)
dprintf("s68k w32: %06x, %08x @%06x", a&0xffffff, d, SekPcS68k);
}
#endif
// -----------------------------------------------------------------

1827
Pico/cd/Memory.s Normal file

File diff suppressed because it is too large Load diff

View file

@ -49,6 +49,9 @@ int PicoResetMCD(int hard)
LC89510_Reset();
Reset_CD();
gfx_cd_reset();
#ifdef _ASM_CD_MEMORY_C
PicoMemResetCD(1);
#endif
return 0;
}

View file

@ -28,7 +28,7 @@ static unsigned int cell_map(int celln)
row = celln & 0x1f;
row |= (celln & 0x7800) >> 6;
break;
default: // just to make compiler happy
default: // never happens, only here to make compiler happy
col = row = 0;
break;
}

View file

@ -99,7 +99,13 @@ int YM2612Write_940(unsigned int a, unsigned int v)
switch( a ) {
case 0: /* address port 0 */
if (!addr_A1 && ST_address == v)
return 0; /* address already selected, don't send this command to 940 */
ST_address = v;
/* don't send DAC or timer related address changes to 940 */
if (!addr_A1 && (v & 0xf0) == 0x20 &&
(v == 0x24 || v == 0x25 || v == 0x26 || v == 0x2a))
return 0;
addr_A1 = 0;
//ret=0;
break;
@ -162,6 +168,8 @@ int YM2612Write_940(unsigned int a, unsigned int v)
break;
case 2: /* address port 1 */
if (addr_A1 && ST_address == v)
return 0;
ST_address = v;
addr_A1 = 1;
//ret=0;
@ -186,7 +194,7 @@ int YM2612Write_940(unsigned int a, unsigned int v)
shared_ctl->writebuff1[writebuff_ptr++] = (a<<8)|v;
}
} else {
printf("warning: writebuff_ptr > 2047\n");
printf("warning: writebuff_ptr > 2047 ([%i] %02x)\n", a, v);
}
}

View file

@ -13,6 +13,7 @@ asm_render = 1
asm_ym2612 = 1
asm_misc = 1
asm_cdpico = 1
asm_cdmemory = 1
#profile = 1
#use_musashi = 1
#up = 1
@ -66,6 +67,10 @@ ifeq "$(asm_cdpico)" "1"
DEFINC += -D_ASM_CD_PICO_C
OBJS += ../../Pico/cd/pico_asm.o
endif
ifeq "$(asm_cdmemory)" "1"
DEFINC += -D_ASM_CD_MEMORY_C
OBJS += ../../Pico/cd/memory_asm.o
endif
# Pico - sound
OBJS += ../../Pico/sound/mix_asm.o
OBJS += ../../Pico/sound/sound.o ../../Pico/sound/sn76496.o ../../Pico/sound/ym2612.o
@ -147,6 +152,9 @@ testrefr.gpe : test.o gp2x.o asmutils.o
../../Pico/cd/pico_asm.o : ../../Pico/cd/Pico.s
@echo $<
@$(AS) $(ASOPT) $< -o $@
../../Pico/cd/memory_asm.o : ../../Pico/cd/Memory.s
@echo $<
@$(AS) $(ASOPT) $< -o $@
# build Cyclone
../../cpu/Cyclone/proj/Cyclone.s :

View file

@ -973,21 +973,11 @@ static void updateSound(int len)
}
static void SkipFrame(int do_sound)
static void SkipFrame(void)
{
void *sndbuff_tmp = 0;
if (PsndOut && !do_sound) {
sndbuff_tmp = PsndOut;
PsndOut = 0;
}
PicoSkipFrame=1;
PicoFrame();
PicoSkipFrame=0;
if (sndbuff_tmp && !do_sound) {
PsndOut = sndbuff_tmp;
}
}
@ -1166,7 +1156,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(1); frames_done++;
SkipFrame(); frames_done++;
}
frames_done -= target_fps; if (frames_done < 0) frames_done = 0;
@ -1179,7 +1169,7 @@ void emu_Loop(void)
if(currentConfig.Frameskip >= 0) { // frameskip enabled
for(i = 0; i < currentConfig.Frameskip; i++) {
updateKeys();
SkipFrame(1); frames_done++;
SkipFrame(); frames_done++;
if (PsndOut) { // do framelimitting if sound is enabled
gettimeofday(&tval, 0);
if(thissec != tval.tv_sec) tval.tv_usec+=1000000;
@ -1191,8 +1181,14 @@ void emu_Loop(void)
}
} else if(tval.tv_usec > lim_time) { // auto frameskip
// no time left for this frame - skip
if (tval.tv_usec - lim_time >= 0x300000) {
/* something caused a slowdown for us (disk access? cache flush?)
* try to recover by resetting timing... */
reset_timing = 1;
continue;
}
updateKeys();
SkipFrame(tval.tv_usec < lim_time+target_frametime); frames_done++;
SkipFrame(/*tval.tv_usec < lim_time+target_frametime*/); frames_done++;
continue;
}
@ -1261,12 +1257,12 @@ if (Pico.m.frame_count == 31563) {
gettimeofday(&tval, 0);
if (thissec != tval.tv_sec) tval.tv_usec+=1000000;
// sleep if we are still too fast
if(PsndOut != 0 || currentConfig.Frameskip < 0)
if (currentConfig.Frameskip < 0 && tval.tv_usec - lim_time >= 0x300000) // slowdown detection
reset_timing = 1;
else if (PsndOut != NULL || currentConfig.Frameskip < 0)
{
// sleep if we are still too fast
// usleep sleeps for ~20ms minimum, so it is not a solution here
gettimeofday(&tval, 0);
if(thissec != tval.tv_sec) tval.tv_usec+=1000000;
if(tval.tv_usec < lim_time)
{
// we are too fast

View file

@ -744,7 +744,7 @@ static void draw_cd_menu_options(int menu_sel, char *b_us, char *b_eu, char *b_j
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&0x0800)?"ON":"OFF"); // 4
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 (slower) %s", (currentConfig.PicoOpt&0x2000)?"ON":"OFF"); // 6
gp2x_text_out8(tl_x, (y+=10), "Better sync (slow) %s", (currentConfig.PicoOpt&0x2000)?"ON":"OFF"); // 6
gp2x_text_out8(tl_x, (y+=10), "ReadAhead buffer %s", ra_buff); // 7
gp2x_text_out8(tl_x, (y+=10), "Done");

View file

@ -214,11 +214,12 @@ Changelog
1.2x
+ ISO files now can be zipped. Note that this causes VERY long loading times.
+ Added data pre-buffering support, this allows to reduce frequency of short pauses
in FMV games, but makes those pauses longer.
in FMV games (caused by SD access), but makes those pauses longer.
* Fixed PCM DMA transfers (intro FMV in Popful Mail).
+ Properly implemented "decode" data transformation (Jaguar XJ220).
* Integrated "better sync" code into cyclone code, what made this mode much faster.
* Fixed a bug related to game specific config saving.
* Frameskipper was skipping sound processing, what caused some audio desyncs. Fixed.
1.201
+ Added basic cheat support (GameGenie and Genecyst patches).