All pastes #90686 Raw Edit

Untitled

public text v1 · immutable
#90686 ·published 2006-07-17 22:55 UTC
rendered paste body
#ifndef AllFiles
#include "SYSDEPNS.h"
#endif

#include "ENDIANAC.h"
#include "ADDRSPAC.h"

#include "MINEM68K.h"

IMPORTFUNC ui5b MM_Access(ui5b Data, blnr WriteMem, blnr ByteSize, CPTR addr);
IMPORTFUNC ui3b *get_real_address(ui5b L, blnr WritableMem, CPTR addr);
IMPORTPROC customreset(void);

#ifdef USE_C68K
// Use Cyclone 68k core

#include "Cyclone.h"

struct Cyclone MacCpu;

GLOBALPROC MINEM68K_Init(ui3b **BankReadAddr, ui3b **BankWritAddr,
        ui3b *fIPL)
{
        // call CycloneInit() here if you set compressed jump tables
        memset(&MacCpu,0,sizeof(MacCpu)); // clear everything

        // Set up callback functions
        MacCpu.fetch8 =MacCpu.read8 =MacRead8;
        MacCpu.fetch16=MacCpu.read16=MacRead16;
        MacCpu.fetch32=MacCpu.read32=MacRead32;
        MacCpu.write8 =MacWrite8;
        MacCpu.write16=MacWrite16;
        MacCpu.write32=MacWrite32;
        // MacRead/MacWrite will just be wrapper functions to MM_Access
        MacCpu.ResetCallback=customreset; // need to use Cyclone .0086 with the correct config for this
}

GLOBALPROC m68k_IPLchangeNtfy(void)
{
        // oh man I don't know what to do here so let's print a message
        iprintf("m68k_IPLchangeNtfy hit\n");
}

GLOBALPROC DiskInsertedPsuedoException(CPTR newpc, ui5b data)
{
        iprintf("DiskInsertedPsuedoException hit\n");
}

GLOBALPROC m68k_reset(void)
{
        memset(&MacCpu,0,MacCpu.pad1-MacCpu.d); // clear all regs
        MacCpu.stopped=0;
        MacCpu.srh =0x27; // Supervisor mode
        MacCpu.a[7]=MacCpu.read32(0); // Stack Pointer
        MacCpu.membase=0;
        MacCpu.pc=MacCpu.checkpc(MacCpu.read32(4)); // Program Counter
}

GLOBALFUNC ui5b GetInstructionsRemaining(void)
{
        return (ui5b)MacCpu.cycles;
}

GLOBALPROC SetInstructionsRemaining(ui5b n)
{
        MacCpu.cycles=(int)n;
}

GLOBALPROC m68k_go_nInstructions(ui5b n)
{
        MacCpu.cycles=(int)n;
        CycloneRun(&MacCpu);
}

#else

typedef unsigned char flagtype;

// rest of original MINEM68K.c follows