📄 mu0.cpp
字号:
/*
* Copyright (c) 2005 Zhejiang University, P.R.China
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
//=============================================================================
/**
* \file Arch/MU0/MU0.cpp
*
* $Id: MU0.cpp,v 1.4 2005/03/11 06:35:25 kehc Exp $
*
* \author Huacheng Ke <sese_zju@yahoo.com.cn>
*/
//=============================================================================
#include "stdafx.h"
#include <Core/Memory.h>
#include "./MU0.h"
#include "./Processor.h"
#include "./Instruction.h"
#include "./Board.h"
#include "./Loader.h"
#include "./Debugger.h"
extern "C" {
MU0_API size_t Wukong_Enum_Module(std::vector<Core::Module_Meta> &res)
{
res.clear();
Core::Module_Manager::append_meta(res, "MU0", Core::Module_Manager::MT_CPU);
Core::Module_Manager::append_meta(res, "Board_MU0", Core::Module_Manager::MT_BOARD);
Core::Module_Manager::append_meta(res, "MU0_Debugger", Core::Module_Manager::MT_DEBUGGER);
Core::Module_Manager::append_meta(res, "MU0_Loader", Core::Module_Manager::MT_LOADER);
return res.size();
}
MU0_API Core::Module * Wukong_Create_Module(const std::string & name)
{
if (name == "MU0")
{
MU0::CPU * module;
MU0::Instruction_Set & instr_set = MU0::Instruction_Set::instance();
instr_set.register_instructions();
Core::Dummy_MMU<Core::u16> * mmu = new Core::Dummy_MMU<Core::u16>();
module = new MU0::CPU(instr_set, mmu);
module->on_create();
return module;
}
if (name == "Board_MU0")
{
MU0::Board_MU0 * module;
module = new MU0::Board_MU0();
module->on_create();
return module;
}
if (name == "MU0_Loader")
{
MU0::Loader * module;
module = new MU0::Loader();
module->on_create();
return module;
}
if (name == "MU0_Debugger")
{
MU0::Debugger * module;
module = new MU0::Debugger();
module->on_create();
return module;
}
return 0;
}
MU0_API bool Wukong_Destroy_Module(const std::string & name, Core::Module * module)
{
assert(name == module->get_name());
if (name == module->get_name())
{
module->on_destroy();
delete module;
return true;
}
else
{
return false;
}
}
}
WXDLL_ENTRY_FUNCTION();
#ifdef WIN32
BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
WUKONG_UNUSED_ARG(lpReserved);
WUKONG_UNUSED_ARG(hModule);
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -