📄 instruction.h
字号:
/*
* 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 Processor/MU0/Instruction.h
*
* $Id: Instruction.h,v 1.2 2005/02/21 09:53:26 kehc Exp $
*
* \author Huacheng Ke <sese_zju@yahoo.com.cn>
*/
//=============================================================================
#ifndef MU0__INSTRUCTION_H_INCLUDED
#define MU0__INSTRUCTION_H_INCLUDED
#include <Core/Instruction.h>
namespace MU0 {
class CPU;
class Instruction : public Core::Instruction
{
public:
enum
{
LDA = 0x0,
STO = 0x1,
ADD = 0x2,
SUB = 0x3,
JMP = 0x4,
JGE = 0x5,
JNE = 0x6,
STP = 0x7
};
CPU & get_cpu(void) const;
virtual void execute(Core::Instruction_Unit binary);
void on_LDA(int op, int operand);
void on_STO(int op, int operand);
void on_ADD(int op, int operand);
void on_SUB(int op, int operand);
void on_JMP(int op, int operand);
void on_JGE(int op, int operand);
void on_JNE(int op, int operand);
void on_STP(int op, int operand);
DECLARE_SINGLETON(Instruction)
};
class Instruction_Set : public Core::Instruction_Set
{
public:
virtual void register_instructions();
protected:
virtual Core::Instruction * classify(Core::Instruction_Unit binary);
DECLARE_SINGLETON(Instruction_Set)
};
} //namespace
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -