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

📄 board.cpp

📁 浙江大学的悟空嵌入式系统模拟器
💻 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/Board.cpp
*
*  $Id: Board.cpp,v 1.6 2005/03/10 11:32:48 kehc Exp $
*
*  \author  Huacheng Ke <sese_zju@yahoo.com.cn>
*/
//=============================================================================

#include "stdafx.h"
#include "./Board.h"
#include "./MU0.h"

#include <Core/System.h>
#include <Core/Memory.h>
#include <Core/Helper.h>
#include <Core/ConfigFile.h>

#include <cstdio>
#include <fstream>

namespace MU0 {


	void Board_MU0::on_create(void) 
	{
		name_ = "Board_MU0";

		Core::Board_16Bit::on_create();

		prepare_rom();

	}

	void Board_MU0::io_do_cycle()
	{
	}

	Core::Interrupt_Type Board_MU0::get_highest_interrupt(void)
	{
		return 0;
	}

	bool Board_MU0::prepare_rom(void)
	{
		std::string filepath = Core::Host_Machine::gen_fullpath(Core::Host_Machine::get_image_path("MU0"),"1.rom");
		std::ifstream fs((const char *)filepath.c_str());
		if (fs.fail())
		{
			return false;
		}

		Core::Bytecode_Type buffer;

		char ch;
		while(fs.get(ch))
		{
			buffer.push_back(ch);
		}

		Core::Memory_16Bit * mem = (Core::Memory_16Bit *)Core::Wukong_Get_System().get_memory((Core::u16)100);
		mem->unchecked_access(Core::Memory_16Bit::MEMORY_WRITE, (Core::u16)100, buffer.size(), buffer);
		return true;


	}

}

⌨️ 快捷键说明

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