mirror of
https://github.com/RaySollium99/picodrive.git
synced 2025-09-06 15:48:05 -04:00
bugfixes, new scaling, double ym upd at 940
git-svn-id: file:///home/notaz/opt/svn/PicoDrive@83 be3aeb3a-fb24-0410-a615-afba39da0efa
This commit is contained in:
parent
3d48f1437f
commit
2433f40912
22 changed files with 360 additions and 171 deletions
|
@ -79,10 +79,8 @@ zip_failed:
|
|||
f = fopen(path, "rb");
|
||||
if (f == NULL) return NULL;
|
||||
|
||||
#ifndef NO_IONBF
|
||||
/* we use our own buffering */
|
||||
setvbuf(f, NULL, _IONBF, 0);
|
||||
#endif
|
||||
|
||||
file = malloc(sizeof(*file));
|
||||
if (file == NULL) {
|
||||
|
|
10
Pico/Pico.c
10
Pico/Pico.c
|
@ -72,7 +72,7 @@ int PicoReset(int hard)
|
|||
PicoMemReset();
|
||||
SekReset();
|
||||
// s68k doesn't have the TAS quirk, so we just globally set normal TAS handler in MCD mode (used by Batman games).
|
||||
CycloneSetRealTAS(PicoMCD & 1);
|
||||
SekSetRealTAS(PicoMCD & 1);
|
||||
SekCycleCntT=0;
|
||||
z80_reset();
|
||||
|
||||
|
@ -486,7 +486,13 @@ static int PicoFrameSimple(void)
|
|||
int y=0,line=0,lines=0,lines_step=0,sects;
|
||||
int cycles_68k_vblock,cycles_68k_block;
|
||||
|
||||
if(Pico.m.pal) {
|
||||
// we don't emulate DMA timing in this mode
|
||||
if (Pico.m.dma_bytes) {
|
||||
Pico.m.dma_bytes=0;
|
||||
Pico.video.status&=~2;
|
||||
}
|
||||
|
||||
if (Pico.m.pal) {
|
||||
// M68k cycles/frame: 152009.78
|
||||
if(pv->reg[1]&8) { // 240 lines
|
||||
cycles_68k_block = (int) ((double) OSC_PAL / 7 / 50 / 312 * 15 + 0.4); // 16 sects, 16*15=240, 7308
|
||||
|
|
|
@ -31,7 +31,7 @@ void mp3_update(int *buffer, int length, int stereo);
|
|||
// enable_ym2612&dac, enable_sn76496, enable_z80, stereo_sound,
|
||||
// alt_renderer, 6button_gamepad, accurate_timing, accurate_sprites,
|
||||
// draw_no_32col_border, external_ym2612, enable_pcm, enable cdda
|
||||
// enable_cdgfx, cd_perfect_sync
|
||||
// enable_cdgfx, cd_perfect_sync, soft_32col_scaling
|
||||
extern int PicoOpt;
|
||||
extern int PicoVer;
|
||||
extern int PicoSkipFrame; // skip rendering frame, but still do sound (if enabled) and emulation stuff
|
||||
|
|
|
@ -311,6 +311,7 @@ int SekInit(void);
|
|||
int SekReset(void);
|
||||
int SekInterrupt(int irq);
|
||||
void SekState(unsigned char *data);
|
||||
void SekSetRealTAS(int use_real);
|
||||
|
||||
// cd/Sek.c
|
||||
int SekInitS68k(void);
|
||||
|
|
|
@ -186,3 +186,11 @@ void SekState(unsigned char *data)
|
|||
memcpy(data+0x40,&PicoM68kCPU.pc, 0x04);
|
||||
#endif
|
||||
}
|
||||
|
||||
void SekSetRealTAS(int use_real)
|
||||
{
|
||||
#ifdef EMU_C68K
|
||||
CycloneSetRealTAS(use_real);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -30,10 +30,13 @@ typedef unsigned int u32;
|
|||
#define rdprintf(...)
|
||||
//#define wrdprintf dprintf
|
||||
#define wrdprintf(...)
|
||||
//#define plprintf dprintf
|
||||
#define plprintf(...)
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
|
||||
// poller detection
|
||||
//#undef USE_POLL_DETECT
|
||||
#define POLL_LIMIT 16
|
||||
#define POLL_CYCLES 124
|
||||
// int m68k_poll_addr, m68k_poll_cnt;
|
||||
|
@ -143,7 +146,7 @@ void m68k_reg_write8(u32 a, u32 d)
|
|||
#ifdef USE_POLL_DETECT
|
||||
if ((s68k_poll_adclk&0xfe) == 2 && s68k_poll_cnt > POLL_LIMIT) {
|
||||
SekSetStopS68k(0); s68k_poll_adclk = 0;
|
||||
//printf("%05i:%03i: s68k poll release, a=%02x\n", Pico.m.frame_count, Pico.m.scanline, a);
|
||||
plprintf("s68k poll release, a=%02x\n", a);
|
||||
}
|
||||
#endif
|
||||
return;
|
||||
|
@ -163,7 +166,7 @@ void m68k_reg_write8(u32 a, u32 d)
|
|||
#ifdef USE_POLL_DETECT
|
||||
if ((s68k_poll_adclk&0xfe) == 0xe && s68k_poll_cnt > POLL_LIMIT) {
|
||||
SekSetStopS68k(0); s68k_poll_adclk = 0;
|
||||
//printf("%05i:%03i: s68k poll release, a=%02x\n", Pico.m.frame_count, Pico.m.scanline, a);
|
||||
plprintf("s68k poll release, a=%02x\n", a);
|
||||
}
|
||||
#endif
|
||||
return;
|
||||
|
@ -174,7 +177,7 @@ void m68k_reg_write8(u32 a, u32 d)
|
|||
#ifdef USE_POLL_DETECT
|
||||
if ((a&0xfe) == (s68k_poll_adclk&0xfe) && s68k_poll_cnt > POLL_LIMIT) {
|
||||
SekSetStopS68k(0); s68k_poll_adclk = 0;
|
||||
//printf("%05i:%03i: s68k poll release, a=%02x\n", Pico.m.frame_count, Pico.m.scanline, a);
|
||||
plprintf("s68k poll release, a=%02x\n", a);
|
||||
}
|
||||
#endif
|
||||
return;
|
||||
|
@ -183,6 +186,31 @@ void m68k_reg_write8(u32 a, u32 d)
|
|||
dprintf("m68k FIXME: invalid write? [%02x] %02x", a, d);
|
||||
}
|
||||
|
||||
#ifndef _ASM_CD_MEMORY_C
|
||||
static
|
||||
#endif
|
||||
u32 s68k_poll_detect(u32 a, u32 d)
|
||||
{
|
||||
#ifdef USE_POLL_DETECT
|
||||
// polling detection
|
||||
if (a == (s68k_poll_adclk&0xff)) {
|
||||
unsigned int clkdiff = SekCyclesDoneS68k() - (s68k_poll_adclk>>8);
|
||||
if (clkdiff <= POLL_CYCLES) {
|
||||
s68k_poll_cnt++;
|
||||
//printf("-- diff: %u, cnt = %i\n", clkdiff, s68k_poll_cnt);
|
||||
if (s68k_poll_cnt > POLL_LIMIT) {
|
||||
SekSetStopS68k(1);
|
||||
plprintf("s68k poll detected @ %06x, a=%02x\n", SekPcS68k, a);
|
||||
}
|
||||
s68k_poll_adclk = (SekCyclesDoneS68k() << 8) | a;
|
||||
return d;
|
||||
}
|
||||
}
|
||||
s68k_poll_adclk = (SekCyclesDoneS68k() << 8) | a;
|
||||
s68k_poll_cnt = 0;
|
||||
#endif
|
||||
return d;
|
||||
}
|
||||
|
||||
#define READ_FONT_DATA(basemask) \
|
||||
{ \
|
||||
|
@ -208,9 +236,9 @@ u32 s68k_reg_read16(u32 a)
|
|||
case 0:
|
||||
return ((Pico_mcd->s68k_regs[0]&3)<<8) | 1; // ver = 0, not in reset state
|
||||
case 2:
|
||||
d = (Pico_mcd->s68k_regs[a]<<8) | (Pico_mcd->s68k_regs[a+1]&0x1f);
|
||||
d = (Pico_mcd->s68k_regs[2]<<8) | (Pico_mcd->s68k_regs[3]&0x1f);
|
||||
//printf("s68k_regs r3: %02x @%06x\n", (u8)d, SekPcS68k);
|
||||
goto poll_detect;
|
||||
return s68k_poll_detect(a, d);
|
||||
case 6:
|
||||
return CDC_Read_Reg();
|
||||
case 8:
|
||||
|
@ -240,31 +268,10 @@ u32 s68k_reg_read16(u32 a)
|
|||
|
||||
d = (Pico_mcd->s68k_regs[a]<<8) | Pico_mcd->s68k_regs[a+1];
|
||||
|
||||
if (a >= 0x0e && a < 0x30) goto poll_detect;
|
||||
if (a >= 0x0e && a < 0x30)
|
||||
return s68k_poll_detect(a, d);
|
||||
|
||||
return d;
|
||||
|
||||
poll_detect:
|
||||
#ifdef USE_POLL_DETECT
|
||||
// polling detection
|
||||
if (a == (s68k_poll_adclk&0xfe)) {
|
||||
unsigned int clkdiff = SekCyclesDoneS68k() - (s68k_poll_adclk>>8);
|
||||
if (clkdiff <= POLL_CYCLES) {
|
||||
s68k_poll_cnt++;
|
||||
//printf("-- diff: %u, cnt = %i\n", clkdiff, s68k_poll_cnt);
|
||||
if (s68k_poll_cnt > POLL_LIMIT) {
|
||||
SekSetStopS68k(1);
|
||||
//printf("%05i:%03i: s68k poll detected @ %06x, a=%02x\n", Pico.m.frame_count, Pico.m.scanline, SekPcS68k, a);
|
||||
}
|
||||
s68k_poll_adclk = (SekCyclesDoneS68k() << 8) | a;
|
||||
return d;
|
||||
}
|
||||
}
|
||||
s68k_poll_adclk = (SekCyclesDoneS68k() << 8) | a;
|
||||
s68k_poll_cnt = 0;
|
||||
|
||||
#endif
|
||||
return d;
|
||||
}
|
||||
|
||||
#ifndef _ASM_CD_MEMORY_C
|
||||
|
@ -407,6 +414,7 @@ static void OtherWrite8End(u32 a, u32 d, int realsize)
|
|||
#include "cell_map.c"
|
||||
#endif // !def _ASM_CD_MEMORY_C
|
||||
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
// Read Rom and read Ram
|
||||
|
||||
|
@ -631,8 +639,11 @@ static void PicoWriteM68k8(u32 a,u8 d)
|
|||
return;
|
||||
}
|
||||
|
||||
if ((a&0xffffc0)==0xa12000)
|
||||
if ((a&0xffffc0)==0xa12000) {
|
||||
rdprintf("m68k_regs w8: [%02x] %02x @%06x", a&0x3f, d, SekPc);
|
||||
m68k_reg_write8(a, d);
|
||||
return;
|
||||
}
|
||||
|
||||
OtherWrite8(a,d,8);
|
||||
}
|
||||
|
@ -688,7 +699,7 @@ static void PicoWriteM68k16(u32 a,u16 d)
|
|||
#ifdef USE_POLL_DETECT
|
||||
if ((s68k_poll_adclk&0xfe) == 0xe && s68k_poll_cnt > POLL_LIMIT) {
|
||||
SekSetStopS68k(0); s68k_poll_adclk = -1;
|
||||
//printf("%05i:%03i: s68k poll release, a=%02x\n", Pico.m.frame_count, Pico.m.scanline, a);
|
||||
plprintf("s68k poll release, a=%02x\n", a);
|
||||
}
|
||||
#endif
|
||||
return;
|
||||
|
@ -755,8 +766,10 @@ static void PicoWriteM68k32(u32 a,u32 d)
|
|||
return;
|
||||
}
|
||||
|
||||
if ((a&0xffffc0)==0xa12000)
|
||||
if ((a&0xffffc0)==0xa12000) {
|
||||
rdprintf("m68k_regs w32: [%02x] %08x @%06x", a&0x3f, d, SekPc);
|
||||
if ((a&0x3e) == 0xe) dprintf("m68k FIXME: w32 [%02x]", a&0x3f);
|
||||
}
|
||||
|
||||
OtherWrite16(a, (u16)(d>>16));
|
||||
OtherWrite16(a+2,(u16)d);
|
||||
|
@ -785,7 +798,13 @@ static u8 PicoReadS68k8(u32 a)
|
|||
if ((a&0xfffe00) == 0xff8000) {
|
||||
a &= 0x1ff;
|
||||
rdprintf("s68k_regs r8: [%02x] @ %06x", a, SekPcS68k);
|
||||
if (a >= 0x58 && a < 0x68)
|
||||
if (a >= 0x0e && a < 0x30) {
|
||||
d = Pico_mcd->s68k_regs[a];
|
||||
s68k_poll_detect(a, d);
|
||||
rdprintf("ret = %02x", (u8)d);
|
||||
goto end;
|
||||
}
|
||||
else if (a >= 0x58 && a < 0x68)
|
||||
d = gfx_cd_read(a&~1);
|
||||
else d = s68k_reg_read16(a&~1);
|
||||
if ((a&1)==0) d>>=8;
|
||||
|
@ -1008,7 +1027,7 @@ static u32 PicoReadS68k32(u32 a)
|
|||
|
||||
// PCM
|
||||
if ((a&0xff8000)==0xff0000) {
|
||||
dprintf("FIXME: s68k_pcm r32: [%06x] @%06x", a, SekPcS68k);
|
||||
dprintf("s68k_pcm r32: [%06x] @%06x", a, SekPcS68k);
|
||||
a &= 0x7fff;
|
||||
if (a >= 0x2000) {
|
||||
a >>= 1;
|
||||
|
@ -1293,6 +1312,7 @@ static void PicoWriteS68k32(u32 a,u32 d)
|
|||
gfx_cd_write16(a, d>>16);
|
||||
gfx_cd_write16(a+2, d&0xffff);
|
||||
} else {
|
||||
if ((a&0x1fe) == 0xe) dprintf("s68k FIXME: w32 [%02x]", a&0x3f);
|
||||
s68k_reg_write8(a, d>>24);
|
||||
s68k_reg_write8(a+1,(d>>16)&0xff);
|
||||
s68k_reg_write8(a+2,(d>>8) &0xff);
|
||||
|
|
|
@ -135,6 +135,8 @@ m_s68k_decode_write_table:
|
|||
.extern s68k_reg_write8
|
||||
.extern s68k_poll_adclk
|
||||
.extern PicoCpuS68k
|
||||
.extern s68k_poll_detect
|
||||
.extern SN76496Write
|
||||
|
||||
|
||||
@ r0=reg3, r1-r3=temp
|
||||
|
@ -993,6 +995,10 @@ m_m68k_write8_vdp:
|
|||
tst r0, #0x70000
|
||||
tsteq r0, #0x000e0
|
||||
bxne lr @ invalid
|
||||
and r2, r0, #0x19
|
||||
cmp r2, #0x11
|
||||
andeq r0, r1, #0xff
|
||||
beq SN76496Write
|
||||
and r1, r1, #0xff
|
||||
orr r1, r1, r1, lsl #8 @ byte access gets mirrored
|
||||
b PicoVideoWrite
|
||||
|
@ -1123,7 +1129,11 @@ m_m68k_write16_vdp:
|
|||
tsteq r0, #0x000e0
|
||||
bxne lr @ invalid
|
||||
bic r0, r0, #1
|
||||
b PicoVideoWrite
|
||||
and r2, r0, #0x18
|
||||
cmp r2, #0x10
|
||||
bne PicoVideoWrite
|
||||
and r0, r1, #0xff
|
||||
b SN76496Write @ lsb goes to 0x11
|
||||
|
||||
|
||||
m_m68k_write16_ram:
|
||||
|
@ -1291,6 +1301,10 @@ m_m68k_write32_vdp:
|
|||
tst r0, #0x70000
|
||||
tsteq r0, #0x000e0
|
||||
bxne lr @ invalid
|
||||
and r2, r0, #0x18
|
||||
cmp r2, #0x10
|
||||
moveq r0, r1, lsr #16
|
||||
beq SN76496Write @ which game is crazy enough to do that?
|
||||
stmfd sp!,{r0,r1,lr}
|
||||
mov r1, r1, lsr #16
|
||||
bl PicoVideoWrite
|
||||
|
@ -1410,6 +1424,9 @@ m_s68k_read8_regs:
|
|||
tst r0, #0x7e00
|
||||
movne r0, #0
|
||||
bxne lr
|
||||
sub r2, r0, #0x0e
|
||||
cmp r2, #(0x30-0x0e)
|
||||
blo m_s68k_read8_comm
|
||||
sub r2, r0, #0x58
|
||||
cmp r2, #0x10
|
||||
ldrlo r2, =gfx_cd_read
|
||||
|
@ -1424,6 +1441,13 @@ m_s68k_read8_regs:
|
|||
and r0, r0, #0xff
|
||||
bx lr
|
||||
|
||||
m_s68k_read8_comm:
|
||||
ldr r1, =(Pico+0x22200)
|
||||
ldr r1, [r1]
|
||||
add r1, r1, #0x110000
|
||||
ldrb r1, [r1, r0]
|
||||
b s68k_poll_detect
|
||||
|
||||
|
||||
@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||
|
||||
|
|
|
@ -1702,7 +1702,9 @@ int YM2612Write_(unsigned int a, unsigned int v)
|
|||
}
|
||||
|
||||
addr = ym2612.OPN.ST.address;
|
||||
#ifndef EXTERNAL_YM2612
|
||||
ym2612.REGS[addr] = v;
|
||||
#endif
|
||||
|
||||
switch( addr & 0xf0 )
|
||||
{
|
||||
|
@ -1800,7 +1802,9 @@ int YM2612Write_(unsigned int a, unsigned int v)
|
|||
}
|
||||
|
||||
addr = ym2612.OPN.ST.address | 0x100;
|
||||
#ifndef EXTERNAL_YM2612
|
||||
ym2612.REGS[addr] = v;
|
||||
#endif
|
||||
|
||||
ret = OPNWriteReg(addr, v);
|
||||
break;
|
||||
|
@ -1869,7 +1873,10 @@ void YM2612PicoStateLoad_(void)
|
|||
}
|
||||
|
||||
|
||||
#ifndef EXTERNAL_YM2612
|
||||
void *YM2612GetRegs(void)
|
||||
{
|
||||
return ym2612.REGS;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue