mirror of
https://github.com/RaySollium99/picodrive.git
synced 2025-09-05 23:37:46 -04:00
Pico version reg, irq3 handling changed
git-svn-id: file:///home/notaz/opt/svn/PicoDrive@443 be3aeb3a-fb24-0410-a615-afba39da0efa
This commit is contained in:
parent
d49b10c2f2
commit
1e6b5e39f4
6 changed files with 67 additions and 34 deletions
55
Pico/Pico.c
55
Pico/Pico.c
|
@ -80,39 +80,19 @@ void PicoPower(void)
|
||||||
PicoReset();
|
PicoReset();
|
||||||
}
|
}
|
||||||
|
|
||||||
int PicoReset(void)
|
PICO_INTERNAL void PicoDetectRegion(void)
|
||||||
{
|
{
|
||||||
unsigned int region=0;
|
int support=0, hw=0, i;
|
||||||
int support=0,hw=0,i=0;
|
|
||||||
unsigned char pal=0;
|
unsigned char pal=0;
|
||||||
unsigned char sram_reg=Pico.m.sram_reg; // must be preserved
|
|
||||||
|
|
||||||
if (Pico.romsize<=0) return 1;
|
if (PicoRegionOverride)
|
||||||
|
|
||||||
/* must call now, so that banking is reset, and correct vectors get fetched */
|
|
||||||
if (PicoResetHook) PicoResetHook();
|
|
||||||
|
|
||||||
PicoMemReset();
|
|
||||||
SekReset();
|
|
||||||
// s68k doesn't have the TAS quirk, so we just globally set normal TAS handler in MCD mode (used by Batman games).
|
|
||||||
SekSetRealTAS(PicoAHW & PAHW_MCD);
|
|
||||||
SekCycleCntT=0;
|
|
||||||
|
|
||||||
if (PicoAHW & PAHW_MCD)
|
|
||||||
// needed for MCD to reset properly, probably some bug hides behind this..
|
|
||||||
memset(Pico.ioports,0,sizeof(Pico.ioports));
|
|
||||||
emustatus = 0;
|
|
||||||
|
|
||||||
Pico.m.dirtyPal = 1;
|
|
||||||
|
|
||||||
if(PicoRegionOverride)
|
|
||||||
{
|
{
|
||||||
support = PicoRegionOverride;
|
support = PicoRegionOverride;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Read cartridge region data:
|
// Read cartridge region data:
|
||||||
region=PicoRead32(0x1f0);
|
int region=PicoRead32(0x1f0);
|
||||||
|
|
||||||
for (i=0;i<4;i++)
|
for (i=0;i<4;i++)
|
||||||
{
|
{
|
||||||
|
@ -153,7 +133,32 @@ int PicoReset(void)
|
||||||
|
|
||||||
Pico.m.hardware=(unsigned char)(hw|0x20); // No disk attached
|
Pico.m.hardware=(unsigned char)(hw|0x20); // No disk attached
|
||||||
Pico.m.pal=pal;
|
Pico.m.pal=pal;
|
||||||
Pico.video.status = 0x3408 | pal; // 'always set' bits | vblank | pal
|
}
|
||||||
|
|
||||||
|
int PicoReset(void)
|
||||||
|
{
|
||||||
|
unsigned char sram_reg=Pico.m.sram_reg; // must be preserved
|
||||||
|
|
||||||
|
if (Pico.romsize<=0) return 1;
|
||||||
|
|
||||||
|
/* must call now, so that banking is reset, and correct vectors get fetched */
|
||||||
|
if (PicoResetHook) PicoResetHook();
|
||||||
|
|
||||||
|
PicoMemReset();
|
||||||
|
SekReset();
|
||||||
|
// s68k doesn't have the TAS quirk, so we just globally set normal TAS handler in MCD mode (used by Batman games).
|
||||||
|
SekSetRealTAS(PicoAHW & PAHW_MCD);
|
||||||
|
SekCycleCntT=0;
|
||||||
|
|
||||||
|
if (PicoAHW & PAHW_MCD)
|
||||||
|
// needed for MCD to reset properly, probably some bug hides behind this..
|
||||||
|
memset(Pico.ioports,0,sizeof(Pico.ioports));
|
||||||
|
emustatus = 0;
|
||||||
|
|
||||||
|
Pico.m.dirtyPal = 1;
|
||||||
|
|
||||||
|
PicoDetectRegion();
|
||||||
|
Pico.video.status = 0x3408 | Pico.m.pal; // 'always set' bits | vblank | pal
|
||||||
|
|
||||||
PsndReset(); // pal must be known here
|
PsndReset(); // pal must be known here
|
||||||
|
|
||||||
|
|
|
@ -78,6 +78,7 @@ typedef struct
|
||||||
// internal
|
// internal
|
||||||
int fifo_bytes;
|
int fifo_bytes;
|
||||||
int line_counter;
|
int line_counter;
|
||||||
|
unsigned int r1, r12;
|
||||||
} picohw_state;
|
} picohw_state;
|
||||||
extern picohw_state PicoPicohw;
|
extern picohw_state PicoPicohw;
|
||||||
|
|
||||||
|
|
|
@ -31,6 +31,7 @@ static u32 PicoReadPico8(u32 a)
|
||||||
{
|
{
|
||||||
switch (a & 0x1f)
|
switch (a & 0x1f)
|
||||||
{
|
{
|
||||||
|
case 0x01: d = PicoPicohw.r1; break;
|
||||||
case 0x03:
|
case 0x03:
|
||||||
d = PicoPad[0]&0x1f; // d-pad
|
d = PicoPad[0]&0x1f; // d-pad
|
||||||
d |= (PicoPad[0]&0x20) << 2; // red button -> C
|
d |= (PicoPad[0]&0x20) << 2; // red button -> C
|
||||||
|
@ -143,6 +144,7 @@ static void PicoWritePico16(u32 a,u16 d)
|
||||||
|
|
||||||
// if (a == 0x800010) dump(d);
|
// if (a == 0x800010) dump(d);
|
||||||
if (a == 0x800010) PicoPicohw.fifo_bytes += 2;
|
if (a == 0x800010) PicoPicohw.fifo_bytes += 2;
|
||||||
|
if (a == 0x800012) PicoPicohw.r12 = d;
|
||||||
|
|
||||||
elprintf(EL_UIO, "w16: %06x, %04x", a&0xffffff, d);
|
elprintf(EL_UIO, "w16: %06x, %04x", a&0xffffff, d);
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,23 +9,32 @@ static int prev_line_cnt_irq3 = 0, prev_line_cnt_irq5 = 0;
|
||||||
|
|
||||||
static void PicoLineHookPico(int count)
|
static void PicoLineHookPico(int count)
|
||||||
{
|
{
|
||||||
|
|
||||||
PicoPicohw.line_counter += count;
|
PicoPicohw.line_counter += count;
|
||||||
if ((PicoPicohw.line_counter & 0xf) == 0 || count > 10)
|
|
||||||
{
|
|
||||||
if (PicoPicohw.fifo_bytes > 0)
|
|
||||||
PicoPicohw.fifo_bytes--;
|
|
||||||
}
|
|
||||||
|
|
||||||
#if 0
|
#if 1
|
||||||
if (PicoPicohw.line_counter - prev_line_cnt_irq3 > 200) {
|
if ((PicoPicohw.r12 & 0x4003) && PicoPicohw.line_counter - prev_line_cnt_irq3 > 200) {
|
||||||
prev_line_cnt_irq3 = PicoPicohw.line_counter;
|
prev_line_cnt_irq3 = PicoPicohw.line_counter;
|
||||||
// just a guess/hack, allows 101 Dalmantians to boot
|
// just a guess/hack, allows 101 Dalmantians to boot
|
||||||
elprintf(EL_ANOMALY, "irq3");
|
elprintf(EL_ANOMALY, "irq3");
|
||||||
SekInterrupt(3);
|
SekInterrupt(3);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (PicoPicohw.fifo_bytes == 16) {
|
||||||
|
prev_line_cnt_irq3 = PicoPicohw.line_counter;
|
||||||
|
elprintf(EL_ANOMALY, "irq3, fb=%i", PicoPicohw.fifo_bytes);
|
||||||
|
SekInterrupt(3);
|
||||||
|
PicoPicohw.fifo_bytes--;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if ((PicoPicohw.line_counter & 3) == 0 || count > 10)
|
||||||
|
{
|
||||||
|
if (PicoPicohw.fifo_bytes > 0)
|
||||||
|
PicoPicohw.fifo_bytes--;
|
||||||
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
if (PicoPicohw.line_counter - prev_line_cnt_irq5 > 512) {
|
if (PicoPicohw.line_counter - prev_line_cnt_irq5 > 512) {
|
||||||
prev_line_cnt_irq5 = PicoPicohw.line_counter;
|
prev_line_cnt_irq5 = PicoPicohw.line_counter;
|
||||||
|
@ -46,6 +55,16 @@ PICO_INTERNAL int PicoInitPico(void)
|
||||||
PicoPicohw.pen_pos[1] = 0x200 + 252/2;
|
PicoPicohw.pen_pos[1] = 0x200 + 252/2;
|
||||||
prev_line_cnt_irq3 = 0, prev_line_cnt_irq5 = 0;
|
prev_line_cnt_irq3 = 0, prev_line_cnt_irq5 = 0;
|
||||||
|
|
||||||
|
// map version register
|
||||||
|
PicoDetectRegion();
|
||||||
|
elprintf(EL_STATUS, "a %x", Pico.m.hardware);
|
||||||
|
switch (Pico.m.hardware >> 6) {
|
||||||
|
case 0: PicoPicohw.r1 = 0x00; break;
|
||||||
|
case 1: PicoPicohw.r1 = 0x00; break;
|
||||||
|
case 2: PicoPicohw.r1 = 0x40; break;
|
||||||
|
case 3: PicoPicohw.r1 = 0x20; break;
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -432,6 +432,7 @@ extern int z80startCycle, z80stopCycle; // in 68k cycles
|
||||||
extern void (*PicoResetHook)(void);
|
extern void (*PicoResetHook)(void);
|
||||||
extern void (*PicoLineHook)(int count);
|
extern void (*PicoLineHook)(int count);
|
||||||
PICO_INTERNAL int CheckDMA(void);
|
PICO_INTERNAL int CheckDMA(void);
|
||||||
|
PICO_INTERNAL void PicoDetectRegion(void);
|
||||||
|
|
||||||
// cd/Pico.c
|
// cd/Pico.c
|
||||||
PICO_INTERNAL int PicoInitMCD(void);
|
PICO_INTERNAL int PicoInitMCD(void);
|
||||||
|
|
|
@ -71,6 +71,11 @@ static gint key_press_event (GtkWidget *widget, GdkEventKey *event)
|
||||||
case 0x19: current_keys |= GP2X_VOL_UP;break; // w
|
case 0x19: current_keys |= GP2X_VOL_UP;break; // w
|
||||||
case 0x2d: log_io_clear(); break; // k
|
case 0x2d: log_io_clear(); break; // k
|
||||||
case 0x2e: log_io_dump(); break; // l
|
case 0x2e: log_io_dump(); break; // l
|
||||||
|
case 0x17: { // tab
|
||||||
|
extern int PicoReset(void);
|
||||||
|
PicoReset();
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue