mirror of
https://github.com/RaySollium99/picodrive.git
synced 2025-09-05 15:27:46 -04:00
initial import
git-svn-id: file:///home/notaz/opt/svn/PicoDrive@2 be3aeb3a-fb24-0410-a615-afba39da0efa
This commit is contained in:
parent
2cadbd5e56
commit
cc68a136aa
341 changed files with 180839 additions and 0 deletions
78
Pico/cd/Sek.c
Normal file
78
Pico/cd/Sek.c
Normal file
|
@ -0,0 +1,78 @@
|
|||
// This is part of Pico Library
|
||||
|
||||
// (c) Copyright 2004 Dave, All rights reserved.
|
||||
// (c) Copyright 2006 notaz, All rights reserved.
|
||||
// Free for non-commercial use.
|
||||
|
||||
// For commercial use, separate licencing terms must be obtained.
|
||||
|
||||
|
||||
#include "../PicoInt.h"
|
||||
|
||||
|
||||
int SekCycleCntS68k=0; // cycles done in this frame
|
||||
int SekCycleAimS68k=0; // cycle aim
|
||||
|
||||
#ifdef EMU_M68K
|
||||
// ---------------------- MUSASHI 68000 ----------------------
|
||||
m68ki_cpu_core PicoS68kCPU; // Mega CD's CPU
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef EMU_M68K
|
||||
int SekIntAckS68k(int level)
|
||||
{
|
||||
dprintf("s68k: int %i ack [%i|%i]", level, Pico.m.scanline, SekCyclesDone());
|
||||
CPU_INT_LEVEL = 0;
|
||||
return M68K_INT_ACK_AUTOVECTOR;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
int SekInitS68k()
|
||||
{
|
||||
#ifdef EMU_M68K
|
||||
{
|
||||
// Musashi is not very context friendly..
|
||||
void *oldcontext = m68ki_cpu_p;
|
||||
m68k_set_context(&PicoS68kCPU);
|
||||
m68k_set_cpu_type(M68K_CPU_TYPE_68000);
|
||||
m68k_init();
|
||||
m68k_set_int_ack_callback(SekIntAckS68k);
|
||||
// m68k_pulse_reset(); // not yet, memmap is not set up
|
||||
m68k_set_context(oldcontext);
|
||||
}
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Reset the 68000:
|
||||
int SekResetS68k()
|
||||
{
|
||||
if (Pico.rom==NULL) return 1;
|
||||
|
||||
#ifdef EMU_M68K
|
||||
{
|
||||
void *oldcontext = m68ki_cpu_p;
|
||||
|
||||
m68k_set_context(&PicoS68kCPU);
|
||||
m68k_pulse_reset();
|
||||
m68k_set_context(oldcontext);
|
||||
}
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int SekInterruptS68k(int irq)
|
||||
{
|
||||
#ifdef EMU_M68K
|
||||
void *oldcontext = m68ki_cpu_p;
|
||||
m68k_set_context(&PicoS68kCPU);
|
||||
m68k_set_irq(irq); // raise irq (gets lowered after taken or must be done in ack)
|
||||
m68k_set_context(oldcontext);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue