mirror of
https://github.com/RaySollium99/picodrive.git
synced 2025-09-06 23:58:04 -04:00
FAME + some random stuff added
git-svn-id: file:///home/notaz/opt/svn/PicoDrive@276 be3aeb3a-fb24-0410-a615-afba39da0efa
This commit is contained in:
parent
7d4906bfc9
commit
70357ce525
22 changed files with 45359 additions and 4395 deletions
46
Pico/Draw.c
46
Pico/Draw.c
|
@ -1186,35 +1186,49 @@ static void FinalizeLineRGB555(int sh)
|
|||
unsigned short *pal=HighPal;
|
||||
int len, i, t, dirtyPal = Pico.m.dirtyPal;
|
||||
|
||||
if(dirtyPal) {
|
||||
unsigned short *ppal=Pico.cram;
|
||||
for(i = 0x3f; i >= 0; i--)
|
||||
pal[i] = (unsigned short) (((ppal[i]&0x00f)<<12)|((ppal[i]&0x0f0)<<3)|((ppal[i]&0xf00)>>7));
|
||||
if (dirtyPal)
|
||||
{
|
||||
unsigned int *spal=(void *)Pico.cram;
|
||||
unsigned int *dpal=(void *)HighPal;
|
||||
for (i = 0x3f/2; i >= 0; i--)
|
||||
#ifdef USE_BGR555
|
||||
dpal[i] = ((spal[i]&0x000f000f)<< 1)|((spal[i]&0x00f000f0)<<3)|((spal[i]&0x0f000f00)<<4);
|
||||
#else
|
||||
dpal[i] = ((spal[i]&0x000f000f)<<12)|((spal[i]&0x00f000f0)<<3)|((spal[i]&0x0f000f00)>>7);
|
||||
#endif
|
||||
Pico.m.dirtyPal = 0;
|
||||
}
|
||||
|
||||
if (Pico.video.reg[12]&1) {
|
||||
len = 320;
|
||||
} else {
|
||||
if(!(PicoOpt&0x100)) pd+=32;
|
||||
len = 256;
|
||||
}
|
||||
|
||||
if(sh) {
|
||||
if(dirtyPal) {
|
||||
if (sh)
|
||||
{
|
||||
if (dirtyPal) {
|
||||
// shadowed pixels
|
||||
for(i = 0x3f; i >= 0; i--)
|
||||
for (i = 0x3f; i >= 0; i--)
|
||||
pal[0x40|i] = pal[0xc0|i] = (unsigned short)((pal[i]>>1)&0x738e);
|
||||
// hilighted pixels
|
||||
for(i = 0x3f; i >= 0; i--) {
|
||||
for (i = 0x3f; i >= 0; i--) {
|
||||
t=pal[i]&0xe71c;t+=0x4208;if(t&0x20)t|=0x1c;if(t&0x800)t|=0x700;if(t&0x10000)t|=0xe000;t&=0xe71c;
|
||||
pal[0x80|i]=(unsigned short)t;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for(i = 0; i < len; i++)
|
||||
if (Pico.video.reg[12]&1) {
|
||||
len = 320;
|
||||
} else {
|
||||
if (!(PicoOpt&0x100)) pd+=32;
|
||||
len = 256;
|
||||
}
|
||||
|
||||
#ifndef PSP
|
||||
for (i = 0; i < len; i++)
|
||||
pd[i] = pal[ps[i]];
|
||||
#else
|
||||
{
|
||||
extern void amips_clut(unsigned short *dst, unsigned char *src, unsigned short *pal, int count);
|
||||
amips_clut(pd, ps, pal, len);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
1423
Pico/Draw_.s
1423
Pico/Draw_.s
File diff suppressed because it is too large
Load diff
42
Pico/Draw_amips.s
Normal file
42
Pico/Draw_amips.s
Normal file
|
@ -0,0 +1,42 @@
|
|||
# vim:filetype=mips
|
||||
|
||||
# only CLUT for now..
|
||||
|
||||
.set noreorder # don't reorder any instructions
|
||||
.set noat # don't use $at
|
||||
|
||||
|
||||
# void amips_clut(unsigned short *dst, unsigned char *src, unsigned short *pal, int count)
|
||||
|
||||
.global amips_clut
|
||||
|
||||
amips_clut:
|
||||
srl $a3, 2
|
||||
amips_clut_loop:
|
||||
lbu $t0, 0($a1) # tried lw here, no improvement noticed
|
||||
lbu $t1, 1($a1)
|
||||
lbu $t2, 2($a1)
|
||||
lbu $t3, 3($a1)
|
||||
sll $t0, 1
|
||||
sll $t1, 1
|
||||
sll $t2, 1
|
||||
sll $t3, 1
|
||||
addu $t0, $a2
|
||||
addu $t1, $a2
|
||||
addu $t2, $a2
|
||||
addu $t3, $a2
|
||||
lhu $t0, 0($t0)
|
||||
lhu $t1, 0($t1)
|
||||
lhu $t2, 0($t2)
|
||||
lhu $t3, 0($t3)
|
||||
ins $t0, $t1, 16, 16 # ins rt, rs, pos, size - Insert size bits starting
|
||||
ins $t2, $t3, 16, 16 # from the LSB of rs into rt starting at position pos
|
||||
sw $t0, 0($a0)
|
||||
sw $t2, 4($a0)
|
||||
addiu $a0, 8
|
||||
addiu $a3, -1
|
||||
bnez $a3, amips_clut_loop
|
||||
addiu $a1, 4
|
||||
jr $ra
|
||||
nop
|
||||
|
1301
Pico/Draw_sh.c
1301
Pico/Draw_sh.c
File diff suppressed because it is too large
Load diff
1527
Pico/Draw_sh.s
1527
Pico/Draw_sh.s
File diff suppressed because it is too large
Load diff
|
@ -45,7 +45,7 @@ void log_io(unsigned int addr, int bits, int rw);
|
|||
#define log_io(...)
|
||||
#endif
|
||||
|
||||
#if defined(EMU_C68K) || defined(EMU_A68K)
|
||||
#if defined(EMU_C68K)
|
||||
static __inline int PicoMemBase(u32 pc)
|
||||
{
|
||||
int membase=0;
|
||||
|
@ -69,10 +69,6 @@ static __inline int PicoMemBase(u32 pc)
|
|||
#endif
|
||||
|
||||
|
||||
#ifdef EMU_A68K
|
||||
extern u8 *OP_ROM=NULL,*OP_RAM=NULL;
|
||||
#endif
|
||||
|
||||
static u32 CPU_CALL PicoCheckPc(u32 pc)
|
||||
{
|
||||
u32 ret=0;
|
||||
|
@ -90,11 +86,6 @@ static u32 CPU_CALL PicoCheckPc(u32 pc)
|
|||
PicoCpu.membase-=pc&0xff000000;
|
||||
|
||||
ret = PicoCpu.membase+pc;
|
||||
#elif defined(EMU_A68K)
|
||||
OP_ROM=(u8 *)PicoMemBase(pc);
|
||||
|
||||
// don't bother calling us back unless it's outside the 64k segment
|
||||
M68000_regs.AsmBank=(pc>>16);
|
||||
#endif
|
||||
return ret;
|
||||
}
|
||||
|
@ -498,8 +489,8 @@ static void CPU_CALL PicoWrite32(u32 a,u32 d)
|
|||
// -----------------------------------------------------------------
|
||||
PICO_INTERNAL void PicoMemSetup(void)
|
||||
{
|
||||
#ifdef EMU_C68K
|
||||
// Setup memory callbacks:
|
||||
#ifdef EMU_C68K
|
||||
PicoCpu.checkpc=PicoCheckPc;
|
||||
PicoCpu.fetch8 =PicoCpu.read8 =PicoRead8;
|
||||
PicoCpu.fetch16=PicoCpu.read16=PicoRead16;
|
||||
|
@ -508,43 +499,16 @@ PICO_INTERNAL void PicoMemSetup(void)
|
|||
PicoCpu.write16=PicoWrite16;
|
||||
PicoCpu.write32=PicoWrite32;
|
||||
#endif
|
||||
#ifdef EMU_F68K
|
||||
PicoCpuM68k.read_byte =PicoRead8;
|
||||
PicoCpuM68k.read_word =PicoRead16;
|
||||
PicoCpuM68k.read_long =PicoRead32;
|
||||
PicoCpuM68k.write_byte=PicoWrite8;
|
||||
PicoCpuM68k.write_word=PicoWrite16;
|
||||
PicoCpuM68k.write_long=PicoWrite32;
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef EMU_A68K
|
||||
struct A68KInter
|
||||
{
|
||||
u32 unknown;
|
||||
u8 (__fastcall *Read8) (u32 a);
|
||||
u16 (__fastcall *Read16)(u32 a);
|
||||
u32 (__fastcall *Read32)(u32 a);
|
||||
void (__fastcall *Write8) (u32 a,u8 d);
|
||||
void (__fastcall *Write16) (u32 a,u16 d);
|
||||
void (__fastcall *Write32) (u32 a,u32 d);
|
||||
void (__fastcall *ChangePc)(u32 a);
|
||||
u8 (__fastcall *PcRel8) (u32 a);
|
||||
u16 (__fastcall *PcRel16)(u32 a);
|
||||
u32 (__fastcall *PcRel32)(u32 a);
|
||||
u16 (__fastcall *Dir16)(u32 a);
|
||||
u32 (__fastcall *Dir32)(u32 a);
|
||||
};
|
||||
|
||||
struct A68KInter a68k_memory_intf=
|
||||
{
|
||||
0,
|
||||
PicoRead8,
|
||||
PicoRead16,
|
||||
PicoRead32,
|
||||
PicoWrite8,
|
||||
PicoWrite16,
|
||||
PicoWrite32,
|
||||
PicoCheckPc,
|
||||
PicoRead8,
|
||||
PicoRead16,
|
||||
PicoRead32,
|
||||
PicoRead16, // unused
|
||||
PicoRead32, // unused
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef EMU_M68K
|
||||
unsigned int m68k_read_pcrelative_CD8 (unsigned int a);
|
||||
|
|
32
Pico/Misc.c
32
Pico/Misc.c
|
@ -316,8 +316,30 @@ PICO_INTERNAL void SRAMUpdPending(unsigned int a, unsigned int d)
|
|||
|
||||
|
||||
#ifndef _ASM_MISC_C
|
||||
typedef struct
|
||||
{
|
||||
int b0;
|
||||
int b1;
|
||||
int b2;
|
||||
int b3;
|
||||
int b4;
|
||||
int b5;
|
||||
int b6;
|
||||
int b7;
|
||||
} intblock;
|
||||
|
||||
PICO_INTERNAL_ASM void memcpy16(unsigned short *dest, unsigned short *src, int count)
|
||||
{
|
||||
if (((int)dest & (int)src & 3) == 0)
|
||||
{
|
||||
if (count >= 32) {
|
||||
memcpy32((int *)dest, (int *)src, count/2);
|
||||
count&=1;
|
||||
} else {
|
||||
for (; count >= 2; count -= 2, dest+=2, src+=2)
|
||||
*(int *)dest = *(int *)src;
|
||||
}
|
||||
}
|
||||
while (count--)
|
||||
*dest++ = *src++;
|
||||
}
|
||||
|
@ -334,6 +356,12 @@ PICO_INTERNAL_ASM void memcpy16bswap(unsigned short *dest, void *src, int count)
|
|||
|
||||
PICO_INTERNAL_ASM void memcpy32(int *dest, int *src, int count)
|
||||
{
|
||||
intblock *bd = (intblock *) dest, *bs = (intblock *) src;
|
||||
|
||||
for (; count >= sizeof(*bd)/4; count -= sizeof(*bd)/4)
|
||||
*bd++ = *bs++;
|
||||
|
||||
dest = (int *)bd; src = (int *)bs;
|
||||
while (count--)
|
||||
*dest++ = *src++;
|
||||
}
|
||||
|
@ -341,6 +369,10 @@ PICO_INTERNAL_ASM void memcpy32(int *dest, int *src, int count)
|
|||
|
||||
PICO_INTERNAL_ASM void memset32(int *dest, int c, int count)
|
||||
{
|
||||
for (; count >= 8; count -= 8, dest += 8)
|
||||
dest[0] = dest[1] = dest[2] = dest[3] =
|
||||
dest[4] = dest[5] = dest[6] = dest[7] = c;
|
||||
|
||||
while (count--)
|
||||
*dest++ = c;
|
||||
}
|
||||
|
|
14
Pico/Pico.c
14
Pico/Pico.c
|
@ -212,12 +212,10 @@ static __inline void SekRunM68k(int cyc)
|
|||
PicoCpu.cycles=cyc_do;
|
||||
CycloneRun(&PicoCpu);
|
||||
SekCycleCnt+=cyc_do-PicoCpu.cycles;
|
||||
#elif defined(EMU_A68K)
|
||||
m68k_ICount=cyc_do;
|
||||
M68000_RUN();
|
||||
SekCycleCnt+=cyc_do-m68k_ICount;
|
||||
#elif defined(EMU_M68K)
|
||||
SekCycleCnt+=m68k_execute(cyc_do);
|
||||
#elif defined(EMU_F68K)
|
||||
SekCycleCnt+=m68k_emulate(cyc_do);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -232,12 +230,10 @@ static __inline void SekStep(void)
|
|||
PicoCpu.cycles=1;
|
||||
CycloneRun(&PicoCpu);
|
||||
SekCycleCnt+=1-PicoCpu.cycles;
|
||||
#elif defined(EMU_A68K)
|
||||
m68k_ICount=1;
|
||||
M68000_RUN();
|
||||
SekCycleCnt+=1-m68k_ICount;
|
||||
#elif defined(EMU_M68K)
|
||||
SekCycleCnt+=m68k_execute(1);
|
||||
#elif defined(EMU_F68K)
|
||||
SekCycleCnt+=m68k_emulate(1);
|
||||
#endif
|
||||
SekCycleAim=realaim;
|
||||
}
|
||||
|
@ -677,6 +673,8 @@ char *debugString(void)
|
|||
}
|
||||
#elif defined(EMU_M68K)
|
||||
sprintf(dstrp, "M68k: PC: %06x, cycles: %u, irql: %i\n", SekPc, SekCyclesDoneT(), PicoM68kCPU.int_level>>8); dstrp+=strlen(dstrp);
|
||||
#elif defined(EMU_F68K)
|
||||
sprintf(dstrp, "M68k: PC: %06x, cycles: %u, irql: %i\n", SekPc, SekCyclesDoneT(), PicoCpuM68k.interrupts[0]); dstrp+=strlen(dstrp);
|
||||
#endif
|
||||
sprintf(dstrp, "z80Run: %i, pal: %i, frame#: %i\n", Pico.m.z80Run, Pico.m.pal, Pico.m.frame_count); dstrp+=strlen(dstrp);
|
||||
z80_debug(dstrp); dstrp+=strlen(dstrp);
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
#define PICO_INTERNAL_ASM
|
||||
#endif
|
||||
|
||||
// to select core, define EMU_C68K, EMU_M68K or EMU_A68K in your makefile or project
|
||||
// to select core, define EMU_C68K, EMU_M68K or EMU_F68K in your makefile or project
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
@ -50,24 +50,28 @@ extern struct Cyclone PicoCpu, PicoCpuS68k;
|
|||
#define SekSetStopS68k(x) { PicoCpuS68k.state_flags&=~1; if (x) { PicoCpuS68k.state_flags|=1; PicoCpuS68k.cycles=0; } }
|
||||
#endif
|
||||
|
||||
#ifdef EMU_A68K
|
||||
void __cdecl M68000_RUN();
|
||||
// The format of the data in a68k.asm (at the _M68000_regs location)
|
||||
struct A68KContext
|
||||
{
|
||||
unsigned int d[8],a[8];
|
||||
unsigned int isp,srh,ccr,xc,pc,irq,sr;
|
||||
int (*IrqCallback) (int nIrq);
|
||||
unsigned int ppc;
|
||||
void *pResetCallback;
|
||||
unsigned int sfc,dfc,usp,vbr;
|
||||
unsigned int AsmBank,CpuVersion;
|
||||
};
|
||||
struct A68KContext M68000_regs;
|
||||
extern int m68k_ICount;
|
||||
#define SekCyclesLeft m68k_ICount
|
||||
#define SekSetCyclesLeft(c) m68k_ICount=c
|
||||
#define SekPc M68000_regs.pc
|
||||
#ifdef EMU_F68K
|
||||
#include "../cpu/fame/fame.h"
|
||||
M68K_CONTEXT PicoCpuM68k, PicoCpuS68k;
|
||||
#define SekCyclesLeftNoMCD PicoCpuM68k.io_cycle_counter
|
||||
#define SekCyclesLeft \
|
||||
(((PicoMCD&1) && (PicoOpt & 0x2000)) ? (SekCycleAim-SekCycleCnt) : SekCyclesLeftNoMCD)
|
||||
#define SekCyclesLeftS68k \
|
||||
((PicoOpt & 0x2000) ? (SekCycleAimS68k-SekCycleCntS68k) : PicoCpuS68k.io_cycle_counter)
|
||||
#define SekSetCyclesLeftNoMCD(c) PicoCpuM68k.io_cycle_counter=c
|
||||
#define SekSetCyclesLeft(c) { \
|
||||
if ((PicoMCD&1) && (PicoOpt & 0x2000)) SekCycleCnt=SekCycleAim-(c); else SekSetCyclesLeftNoMCD(c); \
|
||||
}
|
||||
#define SekPc m68k_get_pc(&PicoCpuM68k)
|
||||
#define SekPcS68k m68k_get_pc(&PicoCpuS68k)
|
||||
#define SekSetStop(x) { \
|
||||
PicoCpuM68k.execinfo &= ~M68K_HALTED; \
|
||||
if (x) { PicoCpuM68k.execinfo |= M68K_HALTED; PicoCpuM68k.io_cycle_counter = 0; } \
|
||||
}
|
||||
#define SekSetStopS68k(x) { \
|
||||
PicoCpuS68k.execinfo &= ~M68K_HALTED; \
|
||||
if (x) { PicoCpuS68k.execinfo |= M68K_HALTED; PicoCpuS68k.io_cycle_counter = 0; } \
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef EMU_M68K
|
||||
|
@ -137,10 +141,10 @@ extern int SekCycleAimS68k;
|
|||
#define SekEndRun(c)
|
||||
#endif
|
||||
|
||||
extern int PicoMCD;
|
||||
|
||||
// ---------------------------------------------------------
|
||||
|
||||
extern int PicoMCD;
|
||||
|
||||
// main oscillator clock which controls timing
|
||||
#define OSC_NTSC 53693100
|
||||
// seems to be accurate, see scans from http://www.hot.ee/tmeeco/
|
||||
|
|
115
Pico/Sek.c
115
Pico/Sek.c
|
@ -14,33 +14,23 @@ int SekCycleCnt=0; // cycles done in this frame
|
|||
int SekCycleAim=0; // cycle aim
|
||||
unsigned int SekCycleCntT=0;
|
||||
|
||||
|
||||
/* context */
|
||||
// Cyclone 68000
|
||||
#ifdef EMU_C68K
|
||||
// ---------------------- Cyclone 68000 ----------------------
|
||||
struct Cyclone PicoCpu;
|
||||
#endif
|
||||
|
||||
// MUSASHI 68000
|
||||
#ifdef EMU_M68K
|
||||
// ---------------------- MUSASHI 68000 ----------------------
|
||||
m68ki_cpu_core PicoM68kCPU; // MD's CPU
|
||||
m68ki_cpu_core PicoM68kCPU;
|
||||
#endif
|
||||
|
||||
#ifdef EMU_A68K
|
||||
// ---------------------- A68K ----------------------
|
||||
|
||||
void __cdecl M68000_RESET();
|
||||
int m68k_ICount=0;
|
||||
unsigned int mem_amask=0xffffff; // 24-bit bus
|
||||
unsigned int mame_debug=0,cur_mrhard=0,m68k_illegal_opcode=0,illegal_op=0,illegal_pc=0,opcode_entry=0; // filler
|
||||
|
||||
static int IrqCallback(int i) { i; return -1; }
|
||||
static int DoReset() { return 0; }
|
||||
static int (*ResetCallback)()=DoReset;
|
||||
|
||||
#pragma warning (disable:4152)
|
||||
// FAME 68000
|
||||
#ifdef EMU_F68K
|
||||
M68K_CONTEXT PicoCpuM68k;
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/* callbacks */
|
||||
#ifdef EMU_C68K
|
||||
// interrupt acknowledgment
|
||||
static int SekIntAck(int level)
|
||||
|
@ -75,7 +65,6 @@ static int SekUnrecognizedOpcode()
|
|||
have_illegal = 1;
|
||||
}
|
||||
#endif
|
||||
//exit(1);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
@ -97,6 +86,35 @@ static int SekTasCallback(void)
|
|||
#endif
|
||||
|
||||
|
||||
#ifdef EMU_F68K
|
||||
static void setup_fame_fetchmap(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
// be default, point everything to fitst 64k of ROM
|
||||
for (i = 0; i < M68K_FETCHBANK1; i++)
|
||||
PicoCpuM68k.Fetch[i] = (unsigned int)Pico.rom - (i<<(24-FAMEC_FETCHBITS));
|
||||
// now real ROM
|
||||
for (i = 0; i < M68K_FETCHBANK1 && (i<<(24-FAMEC_FETCHBITS)) < Pico.romsize; i++)
|
||||
PicoCpuM68k.Fetch[i] = (unsigned int)Pico.rom;
|
||||
elprintf(EL_ANOMALY, "ROM end @ #%i %06x", i, (i<<(24-FAMEC_FETCHBITS)));
|
||||
// .. and RAM (TODO)
|
||||
for (i = M68K_FETCHBANK1*14/16; i < M68K_FETCHBANK1; i++)
|
||||
PicoCpuM68k.Fetch[i] = (unsigned int)Pico.ram - (i<<(24-FAMEC_FETCHBITS));
|
||||
|
||||
elprintf(EL_ANOMALY, "rom = %p, ram = %p", Pico.rom, Pico.ram);
|
||||
for (i = 0; i < M68K_FETCHBANK1; i++)
|
||||
elprintf(EL_ANOMALY, "Fetch[%i] = %p", i, PicoCpuM68k.Fetch[i]);
|
||||
}
|
||||
|
||||
void SekIntAckF68K(unsigned level)
|
||||
{
|
||||
if (level == 4) { Pico.video.pending_ints = 0; elprintf(EL_INTS, "hack: @ %06x [%i]", SekPc, SekCycleCnt); }
|
||||
else if(level == 6) { Pico.video.pending_ints &= ~0x20; elprintf(EL_INTS, "vack: @ %06x [%i]", SekPc, SekCycleCnt); }
|
||||
PicoCpuM68k.interrupts[0] = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
PICO_INTERNAL int SekInit()
|
||||
{
|
||||
|
@ -107,12 +125,6 @@ PICO_INTERNAL int SekInit()
|
|||
PicoCpu.ResetCallback=SekResetAck;
|
||||
PicoCpu.UnrecognizedCallback=SekUnrecognizedOpcode;
|
||||
#endif
|
||||
#ifdef EMU_A68K
|
||||
memset(&M68000_regs,0,sizeof(M68000_regs));
|
||||
M68000_regs.IrqCallback=IrqCallback;
|
||||
M68000_regs.pResetCallback=ResetCallback;
|
||||
M68000_RESET(); // Init cpu emulator
|
||||
#endif
|
||||
#ifdef EMU_M68K
|
||||
{
|
||||
void *oldcontext = m68ki_cpu_p;
|
||||
|
@ -125,10 +137,21 @@ PICO_INTERNAL int SekInit()
|
|||
m68k_set_context(oldcontext);
|
||||
}
|
||||
#endif
|
||||
#ifdef EMU_F68K
|
||||
{
|
||||
void *oldcontext = g_m68kcontext;
|
||||
g_m68kcontext = &PicoCpuM68k;
|
||||
memset(&PicoCpuM68k, 0, sizeof(PicoCpuM68k));
|
||||
m68k_init();
|
||||
PicoCpuM68k.iack_handler = SekIntAckF68K;
|
||||
g_m68kcontext = oldcontext;
|
||||
}
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// Reset the 68000:
|
||||
PICO_INTERNAL int SekReset()
|
||||
{
|
||||
|
@ -144,19 +167,21 @@ PICO_INTERNAL int SekReset()
|
|||
PicoCpu.membase=0;
|
||||
PicoCpu.pc=PicoCpu.checkpc(PicoCpu.read32(4)); // Program Counter
|
||||
#endif
|
||||
#ifdef EMU_A68K
|
||||
// Reset CPU: fetch SP and PC
|
||||
M68000_regs.srh=0x27; // Supervisor mode
|
||||
M68000_regs.a[7]=PicoRead32(0);
|
||||
M68000_regs.pc =PicoRead32(4);
|
||||
PicoInitPc(M68000_regs.pc);
|
||||
#endif
|
||||
#ifdef EMU_M68K
|
||||
m68k_set_context(&PicoM68kCPU); // if we ever reset m68k, we always need it's context to be set
|
||||
m68ki_cpu.sp[0]=0;
|
||||
m68k_set_irq(0);
|
||||
m68k_pulse_reset();
|
||||
#endif
|
||||
#ifdef EMU_F68K
|
||||
{
|
||||
unsigned ret;
|
||||
g_m68kcontext = &PicoCpuM68k;
|
||||
setup_fame_fetchmap();
|
||||
ret = m68k_reset();
|
||||
/*if (ret)*/ elprintf(EL_ANOMALY, "m68k_reset returned %u", ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -174,9 +199,6 @@ PICO_INTERNAL int SekInterrupt(int irq)
|
|||
#ifdef EMU_C68K
|
||||
PicoCpu.irq=irq;
|
||||
#endif
|
||||
#ifdef EMU_A68K
|
||||
M68000_regs.irq=irq; // raise irq (gets lowered after taken)
|
||||
#endif
|
||||
#ifdef EMU_M68K
|
||||
{
|
||||
void *oldcontext = m68ki_cpu_p;
|
||||
|
@ -185,23 +207,23 @@ PICO_INTERNAL int SekInterrupt(int irq)
|
|||
m68k_set_context(oldcontext);
|
||||
}
|
||||
#endif
|
||||
#ifdef EMU_F68K
|
||||
PicoCpuM68k.interrupts[0]=irq;
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
//int SekPc() { return PicoCpu.pc-PicoCpu.membase; }
|
||||
//int SekPc() { return M68000_regs.pc; }
|
||||
//int SekPc() { return m68k_get_reg(NULL, M68K_REG_PC); }
|
||||
|
||||
PICO_INTERNAL void SekState(unsigned char *data)
|
||||
{
|
||||
#ifdef EMU_C68K
|
||||
memcpy(data,PicoCpu.d,0x44);
|
||||
#elif defined(EMU_A68K)
|
||||
memcpy(data, M68000_regs.d, 0x40);
|
||||
memcpy(data+0x40,&M68000_regs.pc,0x04);
|
||||
#elif defined(EMU_M68K)
|
||||
memcpy(data, PicoM68kCPU.dar,0x40);
|
||||
memcpy(data+0x40,&PicoM68kCPU.pc, 0x04);
|
||||
memcpy(data, PicoM68kCPU.dar, 0x40);
|
||||
*(int *)(data+0x40) = PicoM68kCPU.pc;
|
||||
#elif defined(EMU_F68K)
|
||||
memcpy(data, PicoCpuM68k.dreg, 0x40);
|
||||
*(int *)(data+0x40) = PicoCpuM68k.pc;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -210,5 +232,8 @@ PICO_INTERNAL void SekSetRealTAS(int use_real)
|
|||
#ifdef EMU_C68K
|
||||
CycloneSetRealTAS(use_real);
|
||||
#endif
|
||||
#ifdef EMU_F68K
|
||||
// TODO
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue