mirror of
https://github.com/RaySollium99/picodrive.git
synced 2025-09-05 07:17:45 -04:00
Cyclone poll detection problem fixed
git-svn-id: file:///home/notaz/opt/svn/PicoDrive@307 be3aeb3a-fb24-0410-a615-afba39da0efa
This commit is contained in:
parent
ea08c2967b
commit
ca61ee42d9
17 changed files with 97 additions and 139 deletions
|
@ -400,7 +400,6 @@ static int DecodeSmd(unsigned char *data,int len)
|
||||||
static unsigned char *cd_realloc(void *old, int filesize)
|
static unsigned char *cd_realloc(void *old, int filesize)
|
||||||
{
|
{
|
||||||
unsigned char *rom;
|
unsigned char *rom;
|
||||||
dprintf("sizeof(mcd_state): %i", sizeof(mcd_state));
|
|
||||||
rom=realloc(old, sizeof(mcd_state));
|
rom=realloc(old, sizeof(mcd_state));
|
||||||
if (rom) memset(rom+0x20000, 0, sizeof(mcd_state)-0x20000);
|
if (rom) memset(rom+0x20000, 0, sizeof(mcd_state)-0x20000);
|
||||||
return rom;
|
return rom;
|
||||||
|
@ -418,7 +417,6 @@ static unsigned char *PicoCartAlloc(int filesize)
|
||||||
alloc_size&=~0x7ffff; // use alloc size of multiples of 512K, so that memhandlers could be set up more efficiently
|
alloc_size&=~0x7ffff; // use alloc size of multiples of 512K, so that memhandlers could be set up more efficiently
|
||||||
if((filesize&0x3fff)==0x200) alloc_size+=0x200;
|
if((filesize&0x3fff)==0x200) alloc_size+=0x200;
|
||||||
else if(alloc_size-filesize < 4) alloc_size+=4; // padding for out-of-bound exec protection
|
else if(alloc_size-filesize < 4) alloc_size+=4; // padding for out-of-bound exec protection
|
||||||
//dprintf("alloc_size: %x\n", alloc_size);
|
|
||||||
|
|
||||||
// Allocate space for the rom plus padding
|
// Allocate space for the rom plus padding
|
||||||
rom=(unsigned char *)malloc(alloc_size);
|
rom=(unsigned char *)malloc(alloc_size);
|
||||||
|
|
|
@ -1,14 +1,12 @@
|
||||||
// This is part of Pico Library
|
// This is part of Pico Library
|
||||||
|
|
||||||
// (c) Copyright 2004 Dave, All rights reserved.
|
// (c) Copyright 2004 Dave, All rights reserved.
|
||||||
// (c) Copyright 2006 notaz, All rights reserved.
|
// (c) Copyright 2006,2007 notaz, All rights reserved.
|
||||||
// Free for non-commercial use.
|
// Free for non-commercial use.
|
||||||
|
|
||||||
// For commercial use, separate licencing terms must be obtained.
|
// For commercial use, separate licencing terms must be obtained.
|
||||||
|
|
||||||
|
|
||||||
//#define __debug_io
|
|
||||||
|
|
||||||
#include "PicoInt.h"
|
#include "PicoInt.h"
|
||||||
|
|
||||||
#include "sound/ym2612.h"
|
#include "sound/ym2612.h"
|
||||||
|
@ -357,9 +355,7 @@ PICO_INTERNAL_ASM u32 PicoRead8(u32 a)
|
||||||
if ((a&1)==0) d>>=8;
|
if ((a&1)==0) d>>=8;
|
||||||
|
|
||||||
end:
|
end:
|
||||||
#ifdef __debug_io
|
elprintf(EL_IO, "r8 : %06x, %02x @%06x", a&0xffffff, (u8)d, SekPc);
|
||||||
dprintf("r8 : %06x, %02x @%06x", a&0xffffff, (u8)d, SekPc);
|
|
||||||
#endif
|
|
||||||
#ifdef EMU_CORE_DEBUG
|
#ifdef EMU_CORE_DEBUG
|
||||||
if (a>=Pico.romsize) {
|
if (a>=Pico.romsize) {
|
||||||
lastread_a = a;
|
lastread_a = a;
|
||||||
|
@ -394,9 +390,7 @@ PICO_INTERNAL_ASM u32 PicoRead16(u32 a)
|
||||||
else d = OtherRead16(a, 16);
|
else d = OtherRead16(a, 16);
|
||||||
|
|
||||||
end:
|
end:
|
||||||
#ifdef __debug_io
|
elprintf(EL_IO, "r16: %06x, %04x @%06x", a&0xffffff, d, SekPc);
|
||||||
dprintf("r16: %06x, %04x @%06x", a&0xffffff, d, SekPc);
|
|
||||||
#endif
|
|
||||||
#ifdef EMU_CORE_DEBUG
|
#ifdef EMU_CORE_DEBUG
|
||||||
if (a>=Pico.romsize) {
|
if (a>=Pico.romsize) {
|
||||||
lastread_a = a;
|
lastread_a = a;
|
||||||
|
@ -429,9 +423,7 @@ PICO_INTERNAL_ASM u32 PicoRead32(u32 a)
|
||||||
else d = (OtherRead16(a, 32)<<16)|OtherRead16(a+2, 32);
|
else d = (OtherRead16(a, 32)<<16)|OtherRead16(a+2, 32);
|
||||||
|
|
||||||
end:
|
end:
|
||||||
#ifdef __debug_io
|
elprintf(EL_IO, "r32: %06x, %08x @%06x", a&0xffffff, d, SekPc);
|
||||||
dprintf("r32: %06x, %08x @%06x", a&0xffffff, d, SekPc);
|
|
||||||
#endif
|
|
||||||
#ifdef EMU_CORE_DEBUG
|
#ifdef EMU_CORE_DEBUG
|
||||||
if (a>=Pico.romsize) {
|
if (a>=Pico.romsize) {
|
||||||
lastread_a = a;
|
lastread_a = a;
|
||||||
|
@ -448,9 +440,7 @@ end:
|
||||||
#if !defined(_ASM_MEMORY_C) || defined(_ASM_MEMORY_C_AMIPS)
|
#if !defined(_ASM_MEMORY_C) || defined(_ASM_MEMORY_C_AMIPS)
|
||||||
PICO_INTERNAL_ASM void PicoWrite8(u32 a,u8 d)
|
PICO_INTERNAL_ASM void PicoWrite8(u32 a,u8 d)
|
||||||
{
|
{
|
||||||
#ifdef __debug_io
|
elprintf(EL_IO, "w8 : %06x, %02x @%06x", a&0xffffff, d, SekPc);
|
||||||
dprintf("w8 : %06x, %02x @%06x", a&0xffffff, d, SekPc);
|
|
||||||
#endif
|
|
||||||
#ifdef EMU_CORE_DEBUG
|
#ifdef EMU_CORE_DEBUG
|
||||||
lastwrite_cyc_d[lwp_cyc++&15] = d;
|
lastwrite_cyc_d[lwp_cyc++&15] = d;
|
||||||
#endif
|
#endif
|
||||||
|
@ -465,9 +455,7 @@ PICO_INTERNAL_ASM void PicoWrite8(u32 a,u8 d)
|
||||||
|
|
||||||
void PicoWrite16(u32 a,u16 d)
|
void PicoWrite16(u32 a,u16 d)
|
||||||
{
|
{
|
||||||
#ifdef __debug_io
|
elprintf(EL_IO, "w16: %06x, %04x", a&0xffffff, d);
|
||||||
dprintf("w16: %06x, %04x", a&0xffffff, d);
|
|
||||||
#endif
|
|
||||||
#ifdef EMU_CORE_DEBUG
|
#ifdef EMU_CORE_DEBUG
|
||||||
lastwrite_cyc_d[lwp_cyc++&15] = d;
|
lastwrite_cyc_d[lwp_cyc++&15] = d;
|
||||||
#endif
|
#endif
|
||||||
|
@ -482,9 +470,7 @@ void PicoWrite16(u32 a,u16 d)
|
||||||
|
|
||||||
static void PicoWrite32(u32 a,u32 d)
|
static void PicoWrite32(u32 a,u32 d)
|
||||||
{
|
{
|
||||||
#ifdef __debug_io
|
elprintf(EL_IO, "w32: %06x, %08x", a&0xffffff, d);
|
||||||
dprintf("w32: %06x, %08x", a&0xffffff, d);
|
|
||||||
#endif
|
|
||||||
#ifdef EMU_CORE_DEBUG
|
#ifdef EMU_CORE_DEBUG
|
||||||
lastwrite_cyc_d[lwp_cyc++&15] = d;
|
lastwrite_cyc_d[lwp_cyc++&15] = d;
|
||||||
#endif
|
#endif
|
||||||
|
@ -607,9 +593,7 @@ unsigned int m68k_read_memory_8(unsigned int a)
|
||||||
if (a<Pico.romsize && m68ki_cpu_p==&PicoCpuMM68k)
|
if (a<Pico.romsize && m68ki_cpu_p==&PicoCpuMM68k)
|
||||||
d = *(u8 *) (Pico.rom+(a^1));
|
d = *(u8 *) (Pico.rom+(a^1));
|
||||||
else d = (u8) lastread_d[lrp_mus++&15];
|
else d = (u8) lastread_d[lrp_mus++&15];
|
||||||
#ifdef __debug_io
|
elprintf(EL_IO, "r8_mu : %06x, %02x @%06x", a&0xffffff, d, SekPc);
|
||||||
dprintf("r8_mu : %06x, %02x @%06x", a&0xffffff, d, SekPc);
|
|
||||||
#endif
|
|
||||||
return d;
|
return d;
|
||||||
}
|
}
|
||||||
unsigned int m68k_read_memory_16(unsigned int a)
|
unsigned int m68k_read_memory_16(unsigned int a)
|
||||||
|
@ -618,9 +602,7 @@ unsigned int m68k_read_memory_16(unsigned int a)
|
||||||
if (a<Pico.romsize && m68ki_cpu_p==&PicoCpuMM68k)
|
if (a<Pico.romsize && m68ki_cpu_p==&PicoCpuMM68k)
|
||||||
d = *(u16 *)(Pico.rom+(a&~1));
|
d = *(u16 *)(Pico.rom+(a&~1));
|
||||||
else d = (u16) lastread_d[lrp_mus++&15];
|
else d = (u16) lastread_d[lrp_mus++&15];
|
||||||
#ifdef __debug_io
|
elprintf(EL_IO, "r16_mu: %06x, %04x @%06x", a&0xffffff, d, SekPc);
|
||||||
dprintf("r16_mu: %06x, %04x @%06x", a&0xffffff, d, SekPc);
|
|
||||||
#endif
|
|
||||||
return d;
|
return d;
|
||||||
}
|
}
|
||||||
unsigned int m68k_read_memory_32(unsigned int a)
|
unsigned int m68k_read_memory_32(unsigned int a)
|
||||||
|
@ -630,9 +612,7 @@ unsigned int m68k_read_memory_32(unsigned int a)
|
||||||
{ u16 *pm=(u16 *)(Pico.rom+(a&~1));d=(pm[0]<<16)|pm[1]; }
|
{ u16 *pm=(u16 *)(Pico.rom+(a&~1));d=(pm[0]<<16)|pm[1]; }
|
||||||
else if (a <= 0x78) d = m68k_read_32(a, 0);
|
else if (a <= 0x78) d = m68k_read_32(a, 0);
|
||||||
else d = lastread_d[lrp_mus++&15];
|
else d = lastread_d[lrp_mus++&15];
|
||||||
#ifdef __debug_io
|
elprintf(EL_IO, "r32_mu: %06x, %08x @%06x", a&0xffffff, d, SekPc);
|
||||||
dprintf("r32_mu: %06x, %08x @%06x", a&0xffffff, d, SekPc);
|
|
||||||
#endif
|
|
||||||
return d;
|
return d;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -201,7 +201,7 @@ static
|
||||||
void OtherWrite16(u32 a,u32 d)
|
void OtherWrite16(u32 a,u32 d)
|
||||||
{
|
{
|
||||||
if (a==0xa11100) { z80WriteBusReq(d>>8); return; }
|
if (a==0xa11100) { z80WriteBusReq(d>>8); return; }
|
||||||
if (a==0xa11200) { dprintf("write z80reset: %04x", d); if(!(d&0x100)) z80_reset(); return; }
|
if (a==0xa11200) { elprintf(EL_BUSREQ, "write z80reset: %04x", d); if(!(d&0x100)) z80_reset(); return; }
|
||||||
if ((a&0xffffe0)==0xa10000) { IoWrite8(a, d); return; } // I/O ports
|
if ((a&0xffffe0)==0xa10000) { IoWrite8(a, d); return; } // I/O ports
|
||||||
if ((a&0xff4000)==0xa00000) { if(!(Pico.m.z80Run&1)) Pico.zram[a&0x1fff]=(u8)(d>>8); return; } // Z80 ram (MSB only)
|
if ((a&0xff4000)==0xa00000) { if(!(Pico.m.z80Run&1)) Pico.zram[a&0x1fff]=(u8)(d>>8); return; } // Z80 ram (MSB only)
|
||||||
if ((a&0xe700f8)==0xc00010||(a&0xff7ff8)==0xa07f10) { if(PicoOpt&2) SN76496Write(d); return; } // PSG Sound
|
if ((a&0xe700f8)==0xc00010||(a&0xff7ff8)==0xa07f10) { if(PicoOpt&2) SN76496Write(d); return; } // PSG Sound
|
||||||
|
|
|
@ -48,6 +48,7 @@ extern struct Cyclone PicoCpuCM68k, PicoCpuCS68k;
|
||||||
#define SekPcS68k (PicoCpuCS68k.pc-PicoCpuCS68k.membase)
|
#define SekPcS68k (PicoCpuCS68k.pc-PicoCpuCS68k.membase)
|
||||||
#define SekSetStop(x) { PicoCpuCM68k.state_flags&=~1; if (x) { PicoCpuCM68k.state_flags|=1; PicoCpuCM68k.cycles=0; } }
|
#define SekSetStop(x) { PicoCpuCM68k.state_flags&=~1; if (x) { PicoCpuCM68k.state_flags|=1; PicoCpuCM68k.cycles=0; } }
|
||||||
#define SekSetStopS68k(x) { PicoCpuCS68k.state_flags&=~1; if (x) { PicoCpuCS68k.state_flags|=1; PicoCpuCS68k.cycles=0; } }
|
#define SekSetStopS68k(x) { PicoCpuCS68k.state_flags&=~1; if (x) { PicoCpuCS68k.state_flags|=1; PicoCpuCS68k.cycles=0; } }
|
||||||
|
#define SekIsStoppedS68k() (PicoCpuCS68k.state_flags&1)
|
||||||
#define SekShouldInterrupt (PicoCpuCM68k.irq > (PicoCpuCM68k.srh&7))
|
#define SekShouldInterrupt (PicoCpuCM68k.irq > (PicoCpuCM68k.srh&7))
|
||||||
|
|
||||||
#define SekInterrupt(i) PicoCpuCM68k.irq=i
|
#define SekInterrupt(i) PicoCpuCM68k.irq=i
|
||||||
|
@ -79,6 +80,7 @@ extern M68K_CONTEXT PicoCpuFM68k, PicoCpuFS68k;
|
||||||
PicoCpuFS68k.execinfo &= ~FM68K_HALTED; \
|
PicoCpuFS68k.execinfo &= ~FM68K_HALTED; \
|
||||||
if (x) { PicoCpuFS68k.execinfo |= FM68K_HALTED; PicoCpuFS68k.io_cycle_counter = 0; } \
|
if (x) { PicoCpuFS68k.execinfo |= FM68K_HALTED; PicoCpuFS68k.io_cycle_counter = 0; } \
|
||||||
}
|
}
|
||||||
|
#define SekIsStoppedS68k() (PicoCpuFS68k.execinfo&FM68K_HALTED)
|
||||||
#define SekShouldInterrupt fm68k_would_interrupt()
|
#define SekShouldInterrupt fm68k_would_interrupt()
|
||||||
|
|
||||||
#define SekInterrupt(irq) PicoCpuFM68k.interrupts[0]=irq
|
#define SekInterrupt(irq) PicoCpuFM68k.interrupts[0]=irq
|
||||||
|
@ -111,6 +113,7 @@ extern m68ki_cpu_core PicoCpuMM68k, PicoCpuMS68k;
|
||||||
if(x) { SET_CYCLES(0); PicoCpuMS68k.stopped=STOP_LEVEL_STOP; } \
|
if(x) { SET_CYCLES(0); PicoCpuMS68k.stopped=STOP_LEVEL_STOP; } \
|
||||||
else PicoCpuMS68k.stopped=0; \
|
else PicoCpuMS68k.stopped=0; \
|
||||||
}
|
}
|
||||||
|
#define SekIsStoppedS68k() (PicoCpuMS68k.stopped==STOP_LEVEL_STOP)
|
||||||
#define SekShouldInterrupt (CPU_INT_LEVEL > FLAG_INT_MASK)
|
#define SekShouldInterrupt (CPU_INT_LEVEL > FLAG_INT_MASK)
|
||||||
|
|
||||||
#define SekInterrupt(irq) { \
|
#define SekInterrupt(irq) { \
|
||||||
|
@ -478,7 +481,8 @@ PICO_INTERNAL void z80_exit(void);
|
||||||
#define EL_SRAMIO 0x0200 /* sram i/o */
|
#define EL_SRAMIO 0x0200 /* sram i/o */
|
||||||
#define EL_EEPROM 0x0400 /* eeprom debug */
|
#define EL_EEPROM 0x0400 /* eeprom debug */
|
||||||
#define EL_UIO 0x0800 /* unmapped i/o */
|
#define EL_UIO 0x0800 /* unmapped i/o */
|
||||||
#define EL_IO 0x1000 /* all i/o (TODO) */
|
#define EL_IO 0x1000 /* all i/o */
|
||||||
|
#define EL_CDPOLL 0x2000 /* MCD: log poll detection */
|
||||||
|
|
||||||
#define EL_STATUS 0x4000 /* status messages */
|
#define EL_STATUS 0x4000 /* status messages */
|
||||||
#define EL_ANOMALY 0x8000 /* some unexpected conditions (during emulation) */
|
#define EL_ANOMALY 0x8000 /* some unexpected conditions (during emulation) */
|
||||||
|
|
|
@ -9,8 +9,7 @@
|
||||||
|
|
||||||
#include "../PicoInt.h"
|
#include "../PicoInt.h"
|
||||||
|
|
||||||
#define cdprintf dprintf
|
#define cdprintf(x...)
|
||||||
//#define cdprintf(x...)
|
|
||||||
|
|
||||||
|
|
||||||
#define CDC_DMA_SPEED 256
|
#define CDC_DMA_SPEED 256
|
||||||
|
@ -86,7 +85,7 @@ PICO_INTERNAL void Update_CDC_TRansfer(int which)
|
||||||
|
|
||||||
if (Pico_mcd->s68k_regs[0x33] & (1<<5))
|
if (Pico_mcd->s68k_regs[0x33] & (1<<5))
|
||||||
{
|
{
|
||||||
dprintf("cdc DTE irq 5");
|
elprintf(EL_INTS, "cdc DTE irq 5");
|
||||||
SekInterruptS68k(5);
|
SekInterruptS68k(5);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -139,7 +138,7 @@ PICO_INTERNAL void Update_CDC_TRansfer(int which)
|
||||||
else if (which == 4) // PCM RAM (check: popful Mail)
|
else if (which == 4) // PCM RAM (check: popful Mail)
|
||||||
{
|
{
|
||||||
dep = (DMA_Adr & 0x03FF) << 2;
|
dep = (DMA_Adr & 0x03FF) << 2;
|
||||||
dprintf("CD DMA # %04x -> PCM[%i] # %04x, len=%i",
|
cdprintf("CD DMA # %04x -> PCM[%i] # %04x, len=%i",
|
||||||
Pico_mcd->cdc.DAC.N, Pico_mcd->pcm.bank, dep, length);
|
Pico_mcd->cdc.DAC.N, Pico_mcd->pcm.bank, dep, length);
|
||||||
dest = (unsigned short *) (Pico_mcd->pcm_ram_b[Pico_mcd->pcm.bank] + dep);
|
dest = (unsigned short *) (Pico_mcd->pcm_ram_b[Pico_mcd->pcm.bank] + dep);
|
||||||
|
|
||||||
|
@ -212,7 +211,7 @@ PICO_INTERNAL_ASM unsigned short Read_CDC_Host(int is_sub)
|
||||||
Pico_mcd->cdc.IFSTAT &= ~0x40;
|
Pico_mcd->cdc.IFSTAT &= ~0x40;
|
||||||
|
|
||||||
if (Pico_mcd->s68k_regs[0x33]&(1<<5)) {
|
if (Pico_mcd->s68k_regs[0x33]&(1<<5)) {
|
||||||
dprintf("m68k: s68k irq 5");
|
elprintf(EL_INTS, "m68k: s68k irq 5");
|
||||||
SekInterruptS68k(5);
|
SekInterruptS68k(5);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -510,7 +509,7 @@ PICO_INTERNAL void CDD_Export_Status(void)
|
||||||
|
|
||||||
if (Pico_mcd->s68k_regs[0x33] & (1<<4))
|
if (Pico_mcd->s68k_regs[0x33] & (1<<4))
|
||||||
{
|
{
|
||||||
dprintf("cdd export irq 4");
|
elprintf(EL_INTS, "cdd export irq 4");
|
||||||
SekInterruptS68k(4);
|
SekInterruptS68k(4);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
117
Pico/cd/Memory.c
117
Pico/cd/Memory.c
|
@ -3,8 +3,6 @@
|
||||||
// (c) Copyright 2007, Grazvydas "notaz" Ignotas
|
// (c) Copyright 2007, Grazvydas "notaz" Ignotas
|
||||||
|
|
||||||
|
|
||||||
//#define __debug_io
|
|
||||||
|
|
||||||
#include "../PicoInt.h"
|
#include "../PicoInt.h"
|
||||||
|
|
||||||
#include "../sound/ym2612.h"
|
#include "../sound/ym2612.h"
|
||||||
|
@ -20,15 +18,10 @@ typedef unsigned int u32;
|
||||||
#define UTYPES_DEFINED
|
#define UTYPES_DEFINED
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//#define __debug_io
|
|
||||||
//#define __debug_io2
|
|
||||||
|
|
||||||
//#define rdprintf dprintf
|
//#define rdprintf dprintf
|
||||||
#define rdprintf(...)
|
#define rdprintf(...)
|
||||||
//#define wrdprintf dprintf
|
//#define wrdprintf dprintf
|
||||||
#define wrdprintf(...)
|
#define wrdprintf(...)
|
||||||
#define plprintf dprintf
|
|
||||||
//#define plprintf(...)
|
|
||||||
|
|
||||||
#ifdef EMU_CORE_DEBUG
|
#ifdef EMU_CORE_DEBUG
|
||||||
extern u32 lastread_a, lastread_d[16], lastwrite_cyc_d[16];
|
extern u32 lastread_a, lastread_d[16], lastwrite_cyc_d[16];
|
||||||
|
@ -71,7 +64,7 @@ static u32 m68k_reg_read16(u32 a)
|
||||||
d = Read_CDC_Host(0);
|
d = Read_CDC_Host(0);
|
||||||
goto end;
|
goto end;
|
||||||
case 0xA:
|
case 0xA:
|
||||||
dprintf("m68k FIXME: reserved read");
|
elprintf(EL_UIO, "m68k FIXME: reserved read");
|
||||||
goto end;
|
goto end;
|
||||||
case 0xC:
|
case 0xC:
|
||||||
d = Pico_mcd->m.timer_stopwatch >> 16;
|
d = Pico_mcd->m.timer_stopwatch >> 16;
|
||||||
|
@ -85,11 +78,10 @@ static u32 m68k_reg_read16(u32 a)
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
dprintf("m68k_regs FIXME invalid read @ %02x", a);
|
elprintf(EL_UIO, "m68k_regs FIXME invalid read @ %02x", a);
|
||||||
|
|
||||||
end:
|
end:
|
||||||
|
|
||||||
// dprintf("ret = %04x", d);
|
|
||||||
return d;
|
return d;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -105,7 +97,7 @@ void m68k_reg_write8(u32 a, u32 d)
|
||||||
switch (a) {
|
switch (a) {
|
||||||
case 0:
|
case 0:
|
||||||
d &= 1;
|
d &= 1;
|
||||||
if ((d&1) && (Pico_mcd->s68k_regs[0x33]&(1<<2))) { dprintf("m68k: s68k irq 2"); SekInterruptS68k(2); }
|
if ((d&1) && (Pico_mcd->s68k_regs[0x33]&(1<<2))) { elprintf(EL_INTS, "m68k: s68k irq 2"); SekInterruptS68k(2); }
|
||||||
return;
|
return;
|
||||||
case 1:
|
case 1:
|
||||||
d &= 3;
|
d &= 3;
|
||||||
|
@ -149,7 +141,7 @@ void m68k_reg_write8(u32 a, u32 d)
|
||||||
#ifdef USE_POLL_DETECT
|
#ifdef USE_POLL_DETECT
|
||||||
if ((s68k_poll_adclk&0xfe) == 2 && s68k_poll_cnt > POLL_LIMIT) {
|
if ((s68k_poll_adclk&0xfe) == 2 && s68k_poll_cnt > POLL_LIMIT) {
|
||||||
SekSetStopS68k(0); s68k_poll_adclk = 0;
|
SekSetStopS68k(0); s68k_poll_adclk = 0;
|
||||||
plprintf("s68k poll release, a=%02x\n", a);
|
elprintf(EL_CDPOLL, "s68k poll release, a=%02x\n", a);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return;
|
return;
|
||||||
|
@ -169,7 +161,7 @@ void m68k_reg_write8(u32 a, u32 d)
|
||||||
#ifdef USE_POLL_DETECT
|
#ifdef USE_POLL_DETECT
|
||||||
if ((s68k_poll_adclk&0xfe) == 0xe && s68k_poll_cnt > POLL_LIMIT) {
|
if ((s68k_poll_adclk&0xfe) == 0xe && s68k_poll_cnt > POLL_LIMIT) {
|
||||||
SekSetStopS68k(0); s68k_poll_adclk = 0;
|
SekSetStopS68k(0); s68k_poll_adclk = 0;
|
||||||
plprintf("s68k poll release, a=%02x\n", a);
|
elprintf(EL_CDPOLL, "s68k poll release, a=%02x\n", a);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return;
|
return;
|
||||||
|
@ -180,13 +172,13 @@ void m68k_reg_write8(u32 a, u32 d)
|
||||||
#ifdef USE_POLL_DETECT
|
#ifdef USE_POLL_DETECT
|
||||||
if ((a&0xfe) == (s68k_poll_adclk&0xfe) && s68k_poll_cnt > POLL_LIMIT) {
|
if ((a&0xfe) == (s68k_poll_adclk&0xfe) && s68k_poll_cnt > POLL_LIMIT) {
|
||||||
SekSetStopS68k(0); s68k_poll_adclk = 0;
|
SekSetStopS68k(0); s68k_poll_adclk = 0;
|
||||||
plprintf("s68k poll release, a=%02x\n", a);
|
elprintf(EL_CDPOLL, "s68k poll release, a=%02x\n", a);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
dprintf("m68k FIXME: invalid write? [%02x] %02x", a, d);
|
elprintf(EL_UIO, "m68k FIXME: invalid write? [%02x] %02x", a, d);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef _ASM_CD_MEMORY_C
|
#ifndef _ASM_CD_MEMORY_C
|
||||||
|
@ -195,6 +187,8 @@ static
|
||||||
u32 s68k_poll_detect(u32 a, u32 d)
|
u32 s68k_poll_detect(u32 a, u32 d)
|
||||||
{
|
{
|
||||||
#ifdef USE_POLL_DETECT
|
#ifdef USE_POLL_DETECT
|
||||||
|
// needed mostly for Cyclone, which doesn't always check it's cycle counter
|
||||||
|
if (SekIsStoppedS68k()) return d;
|
||||||
// polling detection
|
// polling detection
|
||||||
if (a == (s68k_poll_adclk&0xff)) {
|
if (a == (s68k_poll_adclk&0xff)) {
|
||||||
unsigned int clkdiff = SekCyclesDoneS68k() - (s68k_poll_adclk>>8);
|
unsigned int clkdiff = SekCyclesDoneS68k() - (s68k_poll_adclk>>8);
|
||||||
|
@ -203,7 +197,7 @@ u32 s68k_poll_detect(u32 a, u32 d)
|
||||||
//printf("-- diff: %u, cnt = %i\n", clkdiff, s68k_poll_cnt);
|
//printf("-- diff: %u, cnt = %i\n", clkdiff, s68k_poll_cnt);
|
||||||
if (s68k_poll_cnt > POLL_LIMIT) {
|
if (s68k_poll_cnt > POLL_LIMIT) {
|
||||||
SekSetStopS68k(1);
|
SekSetStopS68k(1);
|
||||||
plprintf("s68k poll detected @ %06x, a=%02x\n", SekPcS68k, a);
|
elprintf(EL_CDPOLL, "s68k poll detected @ %06x, a=%02x\n", SekPcS68k, a);
|
||||||
}
|
}
|
||||||
s68k_poll_adclk = (SekCyclesDoneS68k() << 8) | a;
|
s68k_poll_adclk = (SekCyclesDoneS68k() << 8) | a;
|
||||||
return d;
|
return d;
|
||||||
|
@ -374,7 +368,7 @@ void s68k_reg_write8(u32 a, u32 d)
|
||||||
|
|
||||||
if ((a&0x1f0) == 0x10 || (a >= 0x38 && a < 0x42))
|
if ((a&0x1f0) == 0x10 || (a >= 0x38 && a < 0x42))
|
||||||
{
|
{
|
||||||
dprintf("s68k FIXME: invalid write @ %02x?", a);
|
elprintf(EL_UIO, "s68k FIXME: invalid write @ %02x?", a);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -410,7 +404,7 @@ static u32 OtherRead16End(u32 a, int realsize)
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
dprintf("m68k FIXME: unusual r%i: %06x @%06x", realsize&~1, (a&0xfffffe)+(realsize&1), SekPc);
|
elprintf(EL_UIO, "m68k FIXME: unusual r%i: %06x @%06x", realsize&~1, (a&0xfffffe)+(realsize&1), SekPc);
|
||||||
|
|
||||||
end:
|
end:
|
||||||
return d;
|
return d;
|
||||||
|
@ -434,7 +428,7 @@ static void OtherWrite8End(u32 a, u32 d, int realsize)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
dprintf("m68k FIXME: strange w%i: [%06x], %08x @%06x", realsize, a&0xffffff, d, SekPc);
|
elprintf(EL_UIO, "m68k FIXME: strange w%i: [%06x], %08x @%06x", realsize, a&0xffffff, d, SekPc);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define _CD_MEMORY_C
|
#define _CD_MEMORY_C
|
||||||
|
@ -521,9 +515,7 @@ u32 PicoReadM68k8(u32 a)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef __debug_io
|
elprintf(EL_IO, "r8 : %06x, %02x @%06x", a&0xffffff, (u8)d, SekPc);
|
||||||
dprintf("r8 : %06x, %02x @%06x", a&0xffffff, (u8)d, SekPc);
|
|
||||||
#endif
|
|
||||||
#ifdef EMU_CORE_DEBUG
|
#ifdef EMU_CORE_DEBUG
|
||||||
if (a>=Pico.romsize) {
|
if (a>=Pico.romsize) {
|
||||||
lastread_a = a;
|
lastread_a = a;
|
||||||
|
@ -608,9 +600,7 @@ static u32 PicoReadM68k16(u32 a)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef __debug_io
|
elprintf(EL_IO, "r16: %06x, %04x @%06x", a&0xffffff, d, SekPc);
|
||||||
dprintf("r16: %06x, %04x @%06x", a&0xffffff, d, SekPc);
|
|
||||||
#endif
|
|
||||||
#ifdef EMU_CORE_DEBUG
|
#ifdef EMU_CORE_DEBUG
|
||||||
if (a>=Pico.romsize) {
|
if (a>=Pico.romsize) {
|
||||||
lastread_a = a;
|
lastread_a = a;
|
||||||
|
@ -704,9 +694,7 @@ static u32 PicoReadM68k32(u32 a)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef __debug_io
|
elprintf(EL_IO, "r32: %06x, %08x @%06x", a&0xffffff, d, SekPc);
|
||||||
dprintf("r32: %06x, %08x @%06x", a&0xffffff, d, SekPc);
|
|
||||||
#endif
|
|
||||||
#ifdef EMU_CORE_DEBUG
|
#ifdef EMU_CORE_DEBUG
|
||||||
if (a>=Pico.romsize) {
|
if (a>=Pico.romsize) {
|
||||||
lastread_a = a;
|
lastread_a = a;
|
||||||
|
@ -725,9 +713,7 @@ void PicoWriteM68k8(u32 a,u8 d);
|
||||||
#else
|
#else
|
||||||
void PicoWriteM68k8(u32 a,u8 d)
|
void PicoWriteM68k8(u32 a,u8 d)
|
||||||
{
|
{
|
||||||
#ifdef __debug_io
|
elprintf(EL_IO, "w8 : %06x, %02x @%06x", a&0xffffff, d, SekPc);
|
||||||
dprintf("w8 : %06x, %02x @%06x", a&0xffffff, d, SekPc);
|
|
||||||
#endif
|
|
||||||
#ifdef EMU_CORE_DEBUG
|
#ifdef EMU_CORE_DEBUG
|
||||||
lastwrite_cyc_d[lwp_cyc++&15] = d;
|
lastwrite_cyc_d[lwp_cyc++&15] = d;
|
||||||
#endif
|
#endif
|
||||||
|
@ -778,9 +764,7 @@ void PicoWriteM68k16(u32 a,u16 d);
|
||||||
#else
|
#else
|
||||||
static void PicoWriteM68k16(u32 a,u16 d)
|
static void PicoWriteM68k16(u32 a,u16 d)
|
||||||
{
|
{
|
||||||
#ifdef __debug_io
|
elprintf(EL_IO, "w16: %06x, %04x", a&0xffffff, d);
|
||||||
dprintf("w16: %06x, %04x", a&0xffffff, d);
|
|
||||||
#endif
|
|
||||||
#ifdef EMU_CORE_DEBUG
|
#ifdef EMU_CORE_DEBUG
|
||||||
lastwrite_cyc_d[lwp_cyc++&15] = d;
|
lastwrite_cyc_d[lwp_cyc++&15] = d;
|
||||||
#endif
|
#endif
|
||||||
|
@ -824,7 +808,7 @@ static void PicoWriteM68k16(u32 a,u16 d)
|
||||||
#ifdef USE_POLL_DETECT
|
#ifdef USE_POLL_DETECT
|
||||||
if ((s68k_poll_adclk&0xfe) == 0xe && s68k_poll_cnt > POLL_LIMIT) {
|
if ((s68k_poll_adclk&0xfe) == 0xe && s68k_poll_cnt > POLL_LIMIT) {
|
||||||
SekSetStopS68k(0); s68k_poll_adclk = 0;
|
SekSetStopS68k(0); s68k_poll_adclk = 0;
|
||||||
plprintf("s68k poll release, a=%02x\n", a);
|
elprintf(EL_CDPOLL, "s68k poll release, a=%02x\n", a);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return;
|
return;
|
||||||
|
@ -850,9 +834,7 @@ void PicoWriteM68k32(u32 a,u32 d);
|
||||||
#else
|
#else
|
||||||
static void PicoWriteM68k32(u32 a,u32 d)
|
static void PicoWriteM68k32(u32 a,u32 d)
|
||||||
{
|
{
|
||||||
#ifdef __debug_io
|
elprintf(EL_IO, "w32: %06x, %08x", a&0xffffff, d);
|
||||||
dprintf("w32: %06x, %08x", a&0xffffff, d);
|
|
||||||
#endif
|
|
||||||
#ifdef EMU_CORE_DEBUG
|
#ifdef EMU_CORE_DEBUG
|
||||||
lastwrite_cyc_d[lwp_cyc++&15] = d;
|
lastwrite_cyc_d[lwp_cyc++&15] = d;
|
||||||
#endif
|
#endif
|
||||||
|
@ -968,7 +950,6 @@ static u32 PicoReadS68k8(u32 a)
|
||||||
d = Pico_mcd->word_ram1M[bank][((a>>1)^1)&0x1ffff];
|
d = Pico_mcd->word_ram1M[bank][((a>>1)^1)&0x1ffff];
|
||||||
if (a&1) d &= 0x0f;
|
if (a&1) d &= 0x0f;
|
||||||
else d >>= 4;
|
else d >>= 4;
|
||||||
dprintf("FIXME: decode");
|
|
||||||
} else {
|
} else {
|
||||||
// allow access in any mode, like Gens does
|
// allow access in any mode, like Gens does
|
||||||
d = Pico_mcd->word_ram2M[(a^1)&0x3ffff];
|
d = Pico_mcd->word_ram2M[(a^1)&0x3ffff];
|
||||||
|
@ -991,7 +972,7 @@ static u32 PicoReadS68k8(u32 a)
|
||||||
|
|
||||||
// PCM
|
// PCM
|
||||||
if ((a&0xff8000)==0xff0000) {
|
if ((a&0xff8000)==0xff0000) {
|
||||||
dprintf("s68k_pcm r8: [%06x] @%06x", a, SekPcS68k);
|
elprintf(EL_IO, "s68k_pcm r8: [%06x] @%06x", a, SekPcS68k);
|
||||||
a &= 0x7fff;
|
a &= 0x7fff;
|
||||||
if (a >= 0x2000)
|
if (a >= 0x2000)
|
||||||
d = Pico_mcd->pcm_ram_b[Pico_mcd->pcm.bank][(a>>1)&0xfff];
|
d = Pico_mcd->pcm_ram_b[Pico_mcd->pcm.bank][(a>>1)&0xfff];
|
||||||
|
@ -1000,7 +981,7 @@ static u32 PicoReadS68k8(u32 a)
|
||||||
d = Pico_mcd->pcm.ch[a>>2].addr >> PCM_STEP_SHIFT;
|
d = Pico_mcd->pcm.ch[a>>2].addr >> PCM_STEP_SHIFT;
|
||||||
if (a & 2) d >>= 8;
|
if (a & 2) d >>= 8;
|
||||||
}
|
}
|
||||||
dprintf("ret = %02x", (u8)d);
|
elprintf(EL_IO, "ret = %02x", (u8)d);
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1010,13 +991,11 @@ static u32 PicoReadS68k8(u32 a)
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
dprintf("s68k r8 : %06x, %02x @%06x", a&0xffffff, (u8)d, SekPcS68k);
|
elprintf(EL_UIO, "s68k r8 : %06x, %02x @%06x", a&0xffffff, (u8)d, SekPcS68k);
|
||||||
|
|
||||||
end:
|
end:
|
||||||
|
|
||||||
#ifdef __debug_io2
|
elprintf(EL_IO, "s68k r8 : %06x, %02x @%06x", a&0xffffff, (u8)d, SekPcS68k);
|
||||||
dprintf("s68k r8 : %06x, %02x @%06x", a&0xffffff, (u8)d, SekPcS68k);
|
|
||||||
#endif
|
|
||||||
#ifdef EMU_CORE_DEBUG
|
#ifdef EMU_CORE_DEBUG
|
||||||
lastread_a = ab;
|
lastread_a = ab;
|
||||||
lastread_d[lrp_cyc++&15] = d;
|
lastread_d[lrp_cyc++&15] = d;
|
||||||
|
@ -1064,7 +1043,6 @@ static u32 PicoReadS68k16(u32 a)
|
||||||
int bank = (Pico_mcd->s68k_regs[3]&1)^1;
|
int bank = (Pico_mcd->s68k_regs[3]&1)^1;
|
||||||
d = Pico_mcd->word_ram1M[bank][((a>>1)^1)&0x1ffff];
|
d = Pico_mcd->word_ram1M[bank][((a>>1)^1)&0x1ffff];
|
||||||
d |= d << 4; d &= ~0xf0;
|
d |= d << 4; d &= ~0xf0;
|
||||||
dprintf("FIXME: decode");
|
|
||||||
} else {
|
} else {
|
||||||
// allow access in any mode, like Gens does
|
// allow access in any mode, like Gens does
|
||||||
d = *(u16 *)(Pico_mcd->word_ram2M+(a&0x3fffe));
|
d = *(u16 *)(Pico_mcd->word_ram2M+(a&0x3fffe));
|
||||||
|
@ -1110,13 +1088,11 @@ static u32 PicoReadS68k16(u32 a)
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
dprintf("s68k r16: %06x, %04x @%06x", a&0xffffff, d, SekPcS68k);
|
elprintf(EL_UIO, "s68k r16: %06x, %04x @%06x", a&0xffffff, d, SekPcS68k);
|
||||||
|
|
||||||
end:
|
end:
|
||||||
|
|
||||||
#ifdef __debug_io2
|
elprintf(EL_IO, "s68k r16: %06x, %04x @%06x", a&0xffffff, d, SekPcS68k);
|
||||||
dprintf("s68k r16: %06x, %04x @%06x", a&0xffffff, d, SekPcS68k);
|
|
||||||
#endif
|
|
||||||
#ifdef EMU_CORE_DEBUG
|
#ifdef EMU_CORE_DEBUG
|
||||||
lastread_a = ab;
|
lastread_a = ab;
|
||||||
lastread_d[lrp_cyc++&15] = d;
|
lastread_d[lrp_cyc++&15] = d;
|
||||||
|
@ -1220,13 +1196,11 @@ static u32 PicoReadS68k32(u32 a)
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
dprintf("s68k r32: %06x, %08x @%06x", a&0xffffff, d, SekPcS68k);
|
elprintf(EL_UIO, "s68k r32: %06x, %08x @%06x", a&0xffffff, d, SekPcS68k);
|
||||||
|
|
||||||
end:
|
end:
|
||||||
|
|
||||||
#ifdef __debug_io2
|
elprintf(EL_IO, "s68k r32: %06x, %08x @%06x", a&0xffffff, d, SekPcS68k);
|
||||||
dprintf("s68k r32: %06x, %08x @%06x", a&0xffffff, d, SekPcS68k);
|
|
||||||
#endif
|
|
||||||
#ifdef EMU_CORE_DEBUG
|
#ifdef EMU_CORE_DEBUG
|
||||||
if (ab > 0x78) { // not vectors and stuff
|
if (ab > 0x78) { // not vectors and stuff
|
||||||
lastread_a = ab;
|
lastread_a = ab;
|
||||||
|
@ -1296,9 +1270,7 @@ void PicoWriteS68k8(u32 a,u8 d);
|
||||||
#else
|
#else
|
||||||
static void PicoWriteS68k8(u32 a,u8 d)
|
static void PicoWriteS68k8(u32 a,u8 d)
|
||||||
{
|
{
|
||||||
#ifdef __debug_io2
|
elprintf(EL_IO, "s68k w8 : %06x, %02x @%06x", a&0xffffff, d, SekPcS68k);
|
||||||
dprintf("s68k w8 : %06x, %02x @%06x", a&0xffffff, d, SekPcS68k);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
a&=0xffffff;
|
a&=0xffffff;
|
||||||
|
|
||||||
|
@ -1366,7 +1338,7 @@ static void PicoWriteS68k8(u32 a,u8 d)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
dprintf("s68k w8 : %06x, %02x @%06x", a&0xffffff, d, SekPcS68k);
|
elprintf(EL_UIO, "s68k w8 : %06x, %02x @%06x", a&0xffffff, d, SekPcS68k);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1376,9 +1348,7 @@ void PicoWriteS68k16(u32 a,u16 d);
|
||||||
#else
|
#else
|
||||||
static void PicoWriteS68k16(u32 a,u16 d)
|
static void PicoWriteS68k16(u32 a,u16 d)
|
||||||
{
|
{
|
||||||
#ifdef __debug_io2
|
elprintf(EL_IO, "s68k w16: %06x, %04x @%06x", a&0xffffff, d, SekPcS68k);
|
||||||
dprintf("s68k w16: %06x, %04x @%06x", a&0xffffff, d, SekPcS68k);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
a&=0xfffffe;
|
a&=0xfffffe;
|
||||||
|
|
||||||
|
@ -1456,7 +1426,7 @@ static void PicoWriteS68k16(u32 a,u16 d)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
dprintf("s68k w16: %06x, %04x @%06x", a&0xffffff, d, SekPcS68k);
|
elprintf(EL_UIO, "s68k w16: %06x, %04x @%06x", a&0xffffff, d, SekPcS68k);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1466,9 +1436,7 @@ void PicoWriteS68k32(u32 a,u32 d);
|
||||||
#else
|
#else
|
||||||
static void PicoWriteS68k32(u32 a,u32 d)
|
static void PicoWriteS68k32(u32 a,u32 d)
|
||||||
{
|
{
|
||||||
#ifdef __debug_io2
|
elprintf(EL_IO, "s68k w32: %06x, %08x @%06x", a&0xffffff, d, SekPcS68k);
|
||||||
dprintf("s68k w32: %06x, %08x @%06x", a&0xffffff, d, SekPcS68k);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
a&=0xfffffe;
|
a&=0xfffffe;
|
||||||
|
|
||||||
|
@ -1558,7 +1526,7 @@ static void PicoWriteS68k32(u32 a,u32 d)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
dprintf("s68k w32: %06x, %08x @%06x", a&0xffffff, d, SekPcS68k);
|
elprintf(EL_UIO, "s68k w32: %06x, %08x @%06x", a&0xffffff, d, SekPcS68k);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1586,7 +1554,7 @@ static __inline int PicoMemBaseM68k(u32 pc)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Error - Program Counter is invalid
|
// Error - Program Counter is invalid
|
||||||
dprintf("m68k FIXME: unhandled jump to %06x", pc);
|
elprintf(EL_ANOMALY, "m68k FIXME: unhandled jump to %06x", pc);
|
||||||
|
|
||||||
return (int)Pico_mcd->bios;
|
return (int)Pico_mcd->bios;
|
||||||
}
|
}
|
||||||
|
@ -1617,7 +1585,7 @@ static __inline int PicoMemBaseS68k(u32 pc)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Error - Program Counter is invalid
|
// Error - Program Counter is invalid
|
||||||
dprintf("s68k FIXME: unhandled jump to %06x", pc);
|
elprintf(EL_ANOMALY, "s68k FIXME: unhandled jump to %06x", pc);
|
||||||
|
|
||||||
return (int)Pico_mcd->prg_ram;
|
return (int)Pico_mcd->prg_ram;
|
||||||
}
|
}
|
||||||
|
@ -1658,7 +1626,6 @@ void PicoMemResetCD(int r3)
|
||||||
|
|
||||||
PICO_INTERNAL void PicoMemSetupCD(void)
|
PICO_INTERNAL void PicoMemSetupCD(void)
|
||||||
{
|
{
|
||||||
dprintf("PicoMemSetupCD()");
|
|
||||||
#ifdef EMU_C68K
|
#ifdef EMU_C68K
|
||||||
// Setup m68k memory callbacks:
|
// Setup m68k memory callbacks:
|
||||||
PicoCpuCM68k.checkpc=PicoCheckPcM68k;
|
PicoCpuCM68k.checkpc=PicoCheckPcM68k;
|
||||||
|
@ -1757,7 +1724,7 @@ unsigned int m68k_read_pcrelative_CD8 (unsigned int a)
|
||||||
int bank = (Pico_mcd->s68k_regs[3]&1)^1;
|
int bank = (Pico_mcd->s68k_regs[3]&1)^1;
|
||||||
return *(u8 *)(Pico_mcd->word_ram1M[bank]+((a^1)&0x1ffff));
|
return *(u8 *)(Pico_mcd->word_ram1M[bank]+((a^1)&0x1ffff));
|
||||||
}
|
}
|
||||||
dprintf("s68k_read_pcrelative_CD8 FIXME: can't handle %06x", a);
|
elprintf(EL_ANOMALY, "s68k_read_pcrelative_CD8 FIXME: can't handle %06x", a);
|
||||||
} else {
|
} else {
|
||||||
if((a&0xe00000)==0xe00000) return *(u8 *)(Pico.ram+((a^1)&0xffff)); // Ram
|
if((a&0xe00000)==0xe00000) return *(u8 *)(Pico.ram+((a^1)&0xffff)); // Ram
|
||||||
if(a<0x20000) return *(u8 *)(Pico.rom+(a^1)); // Bios
|
if(a<0x20000) return *(u8 *)(Pico.rom+(a^1)); // Bios
|
||||||
|
@ -1769,7 +1736,7 @@ unsigned int m68k_read_pcrelative_CD8 (unsigned int a)
|
||||||
return *(u8 *)(Pico_mcd->word_ram1M[bank]+((a^1)&0x1ffff));
|
return *(u8 *)(Pico_mcd->word_ram1M[bank]+((a^1)&0x1ffff));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dprintf("m68k_read_pcrelative_CD8 FIXME: can't handle %06x", a);
|
elprintf(EL_ANOMALY, "m68k_read_pcrelative_CD8 FIXME: can't handle %06x", a);
|
||||||
}
|
}
|
||||||
return 0;//(u8) lastread_d;
|
return 0;//(u8) lastread_d;
|
||||||
}
|
}
|
||||||
|
@ -1784,7 +1751,7 @@ unsigned int m68k_read_pcrelative_CD16(unsigned int a)
|
||||||
int bank = (Pico_mcd->s68k_regs[3]&1)^1;
|
int bank = (Pico_mcd->s68k_regs[3]&1)^1;
|
||||||
return *(u16 *)(Pico_mcd->word_ram1M[bank]+(a&0x1fffe));
|
return *(u16 *)(Pico_mcd->word_ram1M[bank]+(a&0x1fffe));
|
||||||
}
|
}
|
||||||
dprintf("s68k_read_pcrelative_CD16 FIXME: can't handle %06x", a);
|
elprintf(EL_ANOMALY, "s68k_read_pcrelative_CD16 FIXME: can't handle %06x", a);
|
||||||
} else {
|
} else {
|
||||||
if((a&0xe00000)==0xe00000) return *(u16 *)(Pico.ram+(a&0xfffe)); // Ram
|
if((a&0xe00000)==0xe00000) return *(u16 *)(Pico.ram+(a&0xfffe)); // Ram
|
||||||
if(a<0x20000) return *(u16 *)(Pico.rom+(a&~1)); // Bios
|
if(a<0x20000) return *(u16 *)(Pico.rom+(a&~1)); // Bios
|
||||||
|
@ -1796,7 +1763,7 @@ unsigned int m68k_read_pcrelative_CD16(unsigned int a)
|
||||||
return *(u16 *)(Pico_mcd->word_ram1M[bank]+(a&0x1fffe));
|
return *(u16 *)(Pico_mcd->word_ram1M[bank]+(a&0x1fffe));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dprintf("m68k_read_pcrelative_CD16 FIXME: can't handle %06x", a);
|
elprintf(EL_ANOMALY, "m68k_read_pcrelative_CD16 FIXME: can't handle %06x", a);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1813,7 +1780,7 @@ unsigned int m68k_read_pcrelative_CD32(unsigned int a)
|
||||||
pm=(u16 *)(Pico_mcd->word_ram1M[bank]+(a&0x1fffe));
|
pm=(u16 *)(Pico_mcd->word_ram1M[bank]+(a&0x1fffe));
|
||||||
return (pm[0]<<16)|pm[1];
|
return (pm[0]<<16)|pm[1];
|
||||||
}
|
}
|
||||||
dprintf("s68k_read_pcrelative_CD32 FIXME: can't handle %06x", a);
|
elprintf(EL_ANOMALY, "s68k_read_pcrelative_CD32 FIXME: can't handle %06x", a);
|
||||||
} else {
|
} else {
|
||||||
if((a&0xe00000)==0xe00000) { u16 *pm=(u16 *)(Pico.ram+(a&0xfffe)); return (pm[0]<<16)|pm[1]; } // Ram
|
if((a&0xe00000)==0xe00000) { u16 *pm=(u16 *)(Pico.ram+(a&0xfffe)); return (pm[0]<<16)|pm[1]; } // Ram
|
||||||
if(a<0x20000) { u16 *pm=(u16 *)(Pico.rom+(a&~1)); return (pm[0]<<16)|pm[1]; }
|
if(a<0x20000) { u16 *pm=(u16 *)(Pico.rom+(a&~1)); return (pm[0]<<16)|pm[1]; }
|
||||||
|
@ -1826,7 +1793,7 @@ unsigned int m68k_read_pcrelative_CD32(unsigned int a)
|
||||||
return (pm[0]<<16)|pm[1];
|
return (pm[0]<<16)|pm[1];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dprintf("m68k_read_pcrelative_CD32 FIXME: can't handle %06x", a);
|
elprintf(EL_ANOMALY, "m68k_read_pcrelative_CD32 FIXME: can't handle %06x", a);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,14 +40,14 @@ static int SekIntAckS68k(int level)
|
||||||
{
|
{
|
||||||
int level_new = new_irq_level(level);
|
int level_new = new_irq_level(level);
|
||||||
|
|
||||||
dprintf("s68kACK %i -> %i", level, level_new);
|
elprintf(EL_INTS, "s68kACK %i -> %i", level, level_new);
|
||||||
PicoCpuCS68k.irq = level_new;
|
PicoCpuCS68k.irq = level_new;
|
||||||
return CYCLONE_INT_ACK_AUTOVECTOR;
|
return CYCLONE_INT_ACK_AUTOVECTOR;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SekResetAckS68k(void)
|
static void SekResetAckS68k(void)
|
||||||
{
|
{
|
||||||
dprintf("s68k: Reset encountered @ %06x", SekPcS68k);
|
elprintf(EL_ANOMALY, "s68k: Reset encountered @ %06x", SekPcS68k);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int SekUnrecognizedOpcodeS68k(void)
|
static int SekUnrecognizedOpcodeS68k(void)
|
||||||
|
@ -55,7 +55,7 @@ static int SekUnrecognizedOpcodeS68k(void)
|
||||||
unsigned int pc, op;
|
unsigned int pc, op;
|
||||||
pc = SekPcS68k;
|
pc = SekPcS68k;
|
||||||
op = PicoCpuCS68k.read16(pc);
|
op = PicoCpuCS68k.read16(pc);
|
||||||
dprintf("Unrecognized Opcode %04x @ %06x", op, pc);
|
elprintf(EL_ANOMALY, "Unrecognized Opcode %04x @ %06x", op, pc);
|
||||||
//exit(1);
|
//exit(1);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -66,7 +66,7 @@ static int SekIntAckMS68k(int level)
|
||||||
{
|
{
|
||||||
#ifndef EMU_CORE_DEBUG
|
#ifndef EMU_CORE_DEBUG
|
||||||
int level_new = new_irq_level(level);
|
int level_new = new_irq_level(level);
|
||||||
dprintf("s68kACK %i -> %i", level, level_new);
|
elprintf(EL_INTS, "s68kACK %i -> %i", level, level_new);
|
||||||
CPU_INT_LEVEL = level_new << 8;
|
CPU_INT_LEVEL = level_new << 8;
|
||||||
#else
|
#else
|
||||||
CPU_INT_LEVEL = 0;
|
CPU_INT_LEVEL = 0;
|
||||||
|
@ -79,7 +79,7 @@ static int SekIntAckMS68k(int level)
|
||||||
static void SekIntAckFS68k(unsigned level)
|
static void SekIntAckFS68k(unsigned level)
|
||||||
{
|
{
|
||||||
int level_new = new_irq_level(level);
|
int level_new = new_irq_level(level);
|
||||||
dprintf("s68kACK %i -> %i", level, level_new);
|
elprintf(EL_INTS, "s68kACK %i -> %i", level, level_new);
|
||||||
#ifndef EMU_CORE_DEBUG
|
#ifndef EMU_CORE_DEBUG
|
||||||
PicoCpuFS68k.interrupts[0] = level_new;
|
PicoCpuFS68k.interrupts[0] = level_new;
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -10,8 +10,7 @@
|
||||||
#include "../PicoInt.h"
|
#include "../PicoInt.h"
|
||||||
#include "cd_file.h"
|
#include "cd_file.h"
|
||||||
|
|
||||||
#define cdprintf dprintf
|
#define cdprintf(x...)
|
||||||
//#define cdprintf(x...)
|
|
||||||
//#define cdprintf(f,...) printf(f "\n",##__VA_ARGS__) // tmp
|
//#define cdprintf(f,...) printf(f "\n",##__VA_ARGS__) // tmp
|
||||||
#define DEBUG_CD
|
#define DEBUG_CD
|
||||||
|
|
||||||
|
@ -279,7 +278,7 @@ PICO_INTERNAL int FILE_Read_One_LBA_CDC(void)
|
||||||
{
|
{
|
||||||
if (Pico_mcd->s68k_regs[0x33] & (1<<5))
|
if (Pico_mcd->s68k_regs[0x33] & (1<<5))
|
||||||
{
|
{
|
||||||
dprintf("cdc dec irq 5");
|
elprintf(EL_INTS, "cdc dec irq 5");
|
||||||
SekInterruptS68k(5);
|
SekInterruptS68k(5);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,8 +13,7 @@
|
||||||
#include "cd_sys.h"
|
#include "cd_sys.h"
|
||||||
#include "cd_file.h"
|
#include "cd_file.h"
|
||||||
|
|
||||||
#define cdprintf dprintf
|
#define cdprintf(x...)
|
||||||
//#define cdprintf(x...)
|
|
||||||
#define DEBUG_CD
|
#define DEBUG_CD
|
||||||
|
|
||||||
#define TRAY_OPEN 0x0500 // TRAY OPEN CDD status
|
#define TRAY_OPEN 0x0500 // TRAY OPEN CDD status
|
||||||
|
|
|
@ -77,7 +77,7 @@ static void gfx_completed(void)
|
||||||
_rot_comp.Reg_64 = 0;
|
_rot_comp.Reg_64 = 0;
|
||||||
if (Pico_mcd->s68k_regs[0x33] & (1<<1))
|
if (Pico_mcd->s68k_regs[0x33] & (1<<1))
|
||||||
{
|
{
|
||||||
dprintf("gfx_cd irq 1");
|
elprintf(EL_INTS, "gfx_cd irq 1");
|
||||||
SekInterruptS68k(1);
|
SekInterruptS68k(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,2 @@
|
||||||
#if defined(__GP2X__)
|
extern void lprintf(const char *fmt, ...);
|
||||||
#include <stdio.h>
|
|
||||||
#define lprintf printf
|
|
||||||
#elif defined(PSP)
|
|
||||||
extern void lprintf(const char *fmt, ...);
|
|
||||||
#else
|
|
||||||
#include "giz.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@ endif
|
||||||
DEFINC = -I../.. -I. -DARM -D__GP2X__ # -DBENCHMARK
|
DEFINC = -I../.. -I. -DARM -D__GP2X__ # -DBENCHMARK
|
||||||
COPT_COMMON = -static -Wall -Winline
|
COPT_COMMON = -static -Wall -Winline
|
||||||
ifeq ($(DEBUG),)
|
ifeq ($(DEBUG),)
|
||||||
COPT_COMMON += -O2 -ftracer -fstrength-reduce -fomit-frame-pointer -fstrict-aliasing -ffast-math
|
COPT_COMMON += -O3 -ftracer -fstrength-reduce -fomit-frame-pointer -fstrict-aliasing -ffast-math
|
||||||
else
|
else
|
||||||
COPT_COMMON += -ggdb
|
COPT_COMMON += -ggdb
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -43,7 +43,7 @@ char romFileName[PATH_MAX];
|
||||||
|
|
||||||
extern int crashed_940;
|
extern int crashed_940;
|
||||||
|
|
||||||
static short sndBuffer[2*44100/50];
|
static short __attribute__((aligned(4))) sndBuffer[2*44100/50];
|
||||||
static struct timeval noticeMsgTime = { 0, 0 }; // when started showing
|
static struct timeval noticeMsgTime = { 0, 0 }; // when started showing
|
||||||
static int osd_fps_x;
|
static int osd_fps_x;
|
||||||
static int combo_keys = 0, combo_acts = 0; // keys and actions which need button combos
|
static int combo_keys = 0, combo_acts = 0; // keys and actions which need button combos
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <stdarg.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
|
@ -375,4 +376,13 @@ void gp2x_deinit(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* lprintf */
|
||||||
|
void lprintf(const char *fmt, ...)
|
||||||
|
{
|
||||||
|
va_list vl;
|
||||||
|
|
||||||
|
va_start(vl, fmt);
|
||||||
|
vprintf(fmt, vl);
|
||||||
|
va_end(vl);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -155,11 +155,12 @@ static void cdload_progress_cb(int percent)
|
||||||
|
|
||||||
smalltext_out16(1, 3*10, "Processing CD image / MP3s", 0xffff);
|
smalltext_out16(1, 3*10, "Processing CD image / MP3s", 0xffff);
|
||||||
smalltext_out16_lim(1, 4*10, romFileName, 0xffff, 80);
|
smalltext_out16_lim(1, 4*10, romFileName, 0xffff, 80);
|
||||||
dst += 30;
|
dst += 320*30;
|
||||||
|
|
||||||
if (len > 320) len = 320;
|
if (len > 320) len = 320;
|
||||||
for (ln = 8; ln > 0; ln--, dst += 320)
|
for (ln = 8; ln > 0; ln--, dst += 320)
|
||||||
memset(dst, 0xff, len*2);
|
memset(dst, 0xff, len*2);
|
||||||
|
menu_flip();
|
||||||
cdload_called = 1;
|
cdload_called = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -182,7 +183,7 @@ void menu_romload_prepare(const char *rom_name)
|
||||||
|
|
||||||
void menu_romload_end(void)
|
void menu_romload_end(void)
|
||||||
{
|
{
|
||||||
PicoCartLoadProgressCB = NULL;
|
PicoCartLoadProgressCB = PicoCDLoadProgressCB = NULL;
|
||||||
smalltext_out16(1, cdload_called ? 60 : 30, "Starting emulation...", 0xffff);
|
smalltext_out16(1, cdload_called ? 60 : 30, "Starting emulation...", 0xffff);
|
||||||
menu_flip();
|
menu_flip();
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
#define CAN_HANDLE_240_LINES 1
|
#define CAN_HANDLE_240_LINES 1
|
||||||
|
|
||||||
// logging emu events
|
// logging emu events
|
||||||
#define EL_LOGMASK 0 // (EL_STATUS|EL_ANOMALY|EL_UIO|EL_SRAMIO) // xffff
|
#define EL_LOGMASK EL_STATUS // (EL_STATUS|EL_ANOMALY|EL_UIO|EL_SRAMIO|EL_INTS|EL_CDPOLL) // xffff
|
||||||
|
|
||||||
//#define dprintf(f,...) printf("%05i:%03i: " f "\n",Pico.m.frame_count,Pico.m.scanline,##__VA_ARGS__)
|
//#define dprintf(f,...) printf("%05i:%03i: " f "\n",Pico.m.frame_count,Pico.m.scanline,##__VA_ARGS__)
|
||||||
#define dprintf(x...)
|
#define dprintf(x...)
|
||||||
|
|
|
@ -428,5 +428,13 @@ void spend_cycles(int c)
|
||||||
usleep(c/200);
|
usleep(c/200);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* lprintf */
|
||||||
|
void lprintf(const char *fmt, ...)
|
||||||
|
{
|
||||||
|
va_list vl;
|
||||||
|
|
||||||
|
va_start(vl, fmt);
|
||||||
|
vprintf(fmt, vl);
|
||||||
|
va_end(vl);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue