⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 arm9es.h

📁 一个任天堂掌上游戏机NDS的源代码
💻 H
📖 第 1 页 / 共 2 页
字号:
/**************************************************************************
* DSemu - The Next Generation                                             *
* Portable ARM9ES core: Class definition [arm9es.h]                       *
* Copyright Imran Nazar, 2005; released under the BSD public licence.     *
**************************************************************************/

#ifndef __ARM9ES_H_
#define __ARM9ES_H_

#include <utility>
#include <map>
#include <stdio.h>
#include "defs.h"
#include "plgcpu.h"
#include "plgmmu32.h"
#include "plggui.h"
#include "datadefs.h"
#include "armdasm.h"
#include "armcopro.h"

// An implementation of the CPU plugin interface.
class ARM9ES : public CPUPlugin
{
    public:
        ARM9ES(std::string name,REQPTR req, UNREQPTR unreq);
        ~ARM9ES();

        PLUGININFO *getinfo();
        void reset();
        void release();
        void status(int,int);

        int exec(int);
	void clockAdd(int);
	void interrupt(int);
	
	void dbgBkptToggle(u32);
	std::map<u32, int> dbgBkptGet();

	void setPC(u32);

    private:

        //---Plugin-generic stuff
        std::string pName, pClass;
        REQPTR pRequest;
        UNREQPTR pUnrequest;
	static PLUGININFO pInfo;
        
        static std::string pluginName;

	//---Start of the stuff we'll be needing
        static MMU32Plugin *MMU;
	static GUIPlugin *GUI;
	
	static u32 *dbgbuffer;
	static int dbgwinID;
        static ARMDasm dasm;
	static u32 rdWhelper(u32);

        static FILE *dumpfile;
	
        //---Register set
        typedef struct {
            u32 r[16], cpsr, spsr[7], flags[8];
            u32 curop, curmode;
            uint64_t clkcount;

            u32 r0,r1,r2,r3,r4,r5,r6,r7,r8,r9,r10,r11,r12,r13,r14,r15;
            u32 r8fiq, r9fiq, r10fiq, r11fiq, r12fiq, r13fiq, r14fiq;
            u32 r13svc, r14svc, r13abt, r14abt, r13irq, r14irq, r13und, r14und;

            u32 tmp1, tmp2, tmp3, tmp4, tmpc;
	    uint64_t tmp64_1, tmp64_2;
        } REGS;

        static REGS reg;

        static std::map<u32, int> bkpts;

	//---Internal flag to/from CPSR helpers
        static void cpsrSplit(), cpsrUpdate();
	
        //---Coprocessors
	static ARMCopro *copro[16];
	
        //---Opcode tables
        typedef int OPCODE;
        typedef OPCODE (*opfptr)();
	typedef int (*intfptr)();

        static const opfptr OLUT[4096];
	static const opfptr TLUT[256];
	static const intfptr condLUT[16];

	//---Mode-switching
	static const char *modeStrings[7];
	static const int modeToCpsrLUT[7];
	static const int modeFromCpsrLUT[16];
	static void modeSwitch(int, int);

        //---Conditional execution helpers
	static int condEQ(), condNE(), condCS(), condCC();
	static int condMI(), condPL(), condVS(), condVC();
	static int condHI(), condLS(), condGE(), condLT();
	static int condGT(), condLE(), condAL(), condNV();
	
        //---Instructions

	// Helper functions
	static u32 nlpo2(u32);
	static int ssum16(u16);
        
	static OPCODE opUNP();   // Unpredictable op
        static OPCODE opUND();   // Undefined op
        static OPCODE opUNI();   // Unimplemented op
	static OPCODE opUNL();   // Unlinked (opcode cache filler)
	
        //---Branch (with Link)----------------------------------------------------

        static OPCODE opB(), opBL();
        static OPCODE opBX();
	
        static OPCODE opBLX(), opBLXr();

        //---DP (DataProcessing); LsL/LsR/AsR/RoR; Immediate/Register--------------

        static OPCODE opANDlli(), opANDllr();
        static OPCODE opANDlri(), opANDlrr();
        static OPCODE opANDari(), opANDarr();
        static OPCODE opANDrri(), opANDrrr();
        static OPCODE opANDimm();

        static OPCODE opEORlli(), opEORllr();
        static OPCODE opEORlri(), opEORlrr();
        static OPCODE opEORari(), opEORarr();
        static OPCODE opEORrri(), opEORrrr();
        static OPCODE opEORimm();

        static OPCODE opSUBlli(), opSUBllr();
        static OPCODE opSUBlri(), opSUBlrr();
        static OPCODE opSUBari(), opSUBarr();
        static OPCODE opSUBrri(), opSUBrrr();
        static OPCODE opSUBimm();

        static OPCODE opRSBlli(), opRSBllr();
        static OPCODE opRSBlri(), opRSBlrr();
        static OPCODE opRSBari(), opRSBarr();
        static OPCODE opRSBrri(), opRSBrrr();
        static OPCODE opRSBimm();

        static OPCODE opADDlli(), opADDllr();
        static OPCODE opADDlri(), opADDlrr();
        static OPCODE opADDari(), opADDarr();
        static OPCODE opADDrri(), opADDrrr();
        static OPCODE opADDimm();

        static OPCODE opADClli(), opADCllr();
        static OPCODE opADClri(), opADClrr();
        static OPCODE opADCari(), opADCarr();
        static OPCODE opADCrri(), opADCrrr();
        static OPCODE opADCimm();

        static OPCODE opSBClli(), opSBCllr();
        static OPCODE opSBClri(), opSBClrr();
        static OPCODE opSBCari(), opSBCarr();
        static OPCODE opSBCrri(), opSBCrrr();
        static OPCODE opSBCimm();

        static OPCODE opRSClli(), opRSCllr();
        static OPCODE opRSClri(), opRSClrr();
        static OPCODE opRSCari(), opRSCarr();
        static OPCODE opRSCrri(), opRSCrrr();
        static OPCODE opRSCimm();

        static OPCODE opORRlli(), opORRllr();
        static OPCODE opORRlri(), opORRlrr();
        static OPCODE opORRari(), opORRarr();
        static OPCODE opORRrri(), opORRrrr();
        static OPCODE opORRimm();

        static OPCODE opMOVlli(), opMOVllr();
        static OPCODE opMOVlri(), opMOVlrr();
        static OPCODE opMOVari(), opMOVarr();
        static OPCODE opMOVrri(), opMOVrrr();
        static OPCODE opMOVimm();

        static OPCODE opBIClli(), opBICllr();
        static OPCODE opBIClri(), opBIClrr();
        static OPCODE opBICari(), opBICarr();
        static OPCODE opBICrri(), opBICrrr();
        static OPCODE opBICimm();

        static OPCODE opMVNlli(), opMVNllr();
        static OPCODE opMVNlri(), opMVNlrr();
        static OPCODE opMVNari(), opMVNarr();
        static OPCODE opMVNrri(), opMVNrrr();
        static OPCODE opMVNimm();

        static OPCODE opANDSlli(), opANDSllr();
        static OPCODE opANDSlri(), opANDSlrr();
        static OPCODE opANDSari(), opANDSarr();
        static OPCODE opANDSrri(), opANDSrrr();
        static OPCODE opANDSimm();

        static OPCODE opEORSlli(), opEORSllr();
        static OPCODE opEORSlri(), opEORSlrr();
        static OPCODE opEORSari(), opEORSarr();
        static OPCODE opEORSrri(), opEORSrrr();
        static OPCODE opEORSimm();

        static OPCODE opSUBSlli(), opSUBSllr();
        static OPCODE opSUBSlri(), opSUBSlrr();
        static OPCODE opSUBSari(), opSUBSarr();
        static OPCODE opSUBSrri(), opSUBSrrr();
        static OPCODE opSUBSimm();

        static OPCODE opRSBSlli(), opRSBSllr();
        static OPCODE opRSBSlri(), opRSBSlrr();
        static OPCODE opRSBSari(), opRSBSarr();
        static OPCODE opRSBSrri(), opRSBSrrr();
        static OPCODE opRSBSimm();

        static OPCODE opADDSlli(), opADDSllr();
        static OPCODE opADDSlri(), opADDSlrr();
        static OPCODE opADDSari(), opADDSarr();
        static OPCODE opADDSrri(), opADDSrrr();
        static OPCODE opADDSimm();

        static OPCODE opADCSlli(), opADCSllr();
        static OPCODE opADCSlri(), opADCSlrr();
        static OPCODE opADCSari(), opADCSarr();
        static OPCODE opADCSrri(), opADCSrrr();
        static OPCODE opADCSimm();

        static OPCODE opSBCSlli(), opSBCSllr();
        static OPCODE opSBCSlri(), opSBCSlrr();
        static OPCODE opSBCSari(), opSBCSarr();
        static OPCODE opSBCSrri(), opSBCSrrr();
        static OPCODE opSBCSimm();

        static OPCODE opRSCSlli(), opRSCSllr();
        static OPCODE opRSCSlri(), opRSCSlrr();
        static OPCODE opRSCSari(), opRSCSarr();
        static OPCODE opRSCSrri(), opRSCSrrr();
        static OPCODE opRSCSimm();

        static OPCODE opTSTSlli(), opTSTSllr();
        static OPCODE opTSTSlri(), opTSTSlrr();
        static OPCODE opTSTSari(), opTSTSarr();
        static OPCODE opTSTSrri(), opTSTSrrr();
        static OPCODE opTSTSimm();

        static OPCODE opTEQSlli(), opTEQSllr();
        static OPCODE opTEQSlri(), opTEQSlrr();
        static OPCODE opTEQSari(), opTEQSarr();
        static OPCODE opTEQSrri(), opTEQSrrr();
        static OPCODE opTEQSimm();

        static OPCODE opCMPSlli(), opCMPSllr();
        static OPCODE opCMPSlri(), opCMPSlrr();
        static OPCODE opCMPSari(), opCMPSarr();
        static OPCODE opCMPSrri(), opCMPSrrr();
        static OPCODE opCMPSimm();

        static OPCODE opCMNSlli(), opCMNSllr();
        static OPCODE opCMNSlri(), opCMNSlrr();
        static OPCODE opCMNSari(), opCMNSarr();
        static OPCODE opCMNSrri(), opCMNSrrr();
        static OPCODE opCMNSimm();

        static OPCODE opORRSlli(), opORRSllr();
        static OPCODE opORRSlri(), opORRSlrr();
        static OPCODE opORRSari(), opORRSarr();
        static OPCODE opORRSrri(), opORRSrrr();
        static OPCODE opORRSimm();

        static OPCODE opMOVSlli(), opMOVSllr();
        static OPCODE opMOVSlri(), opMOVSlrr();
        static OPCODE opMOVSari(), opMOVSarr();
        static OPCODE opMOVSrri(), opMOVSrrr();
        static OPCODE opMOVSimm();

        static OPCODE opBICSlli(), opBICSllr();
        static OPCODE opBICSlri(), opBICSlrr();
        static OPCODE opBICSari(), opBICSarr();
        static OPCODE opBICSrri(), opBICSrrr();
        static OPCODE opBICSimm();

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -