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

📄 instruction.cpp

📁 一个简易的CPU模拟程序
💻 CPP
字号:
#include "StdAfx.h"
#include ".\instruction.h"
#include "OpCode.h"

Instruction::Instruction()
{
}

Instruction::~Instruction(void)
{
}

bool Instruction::SetInstruct(CString ins)
{
	int curpos=0;
	instruct=ins;
	CString str=ins.Tokenize(" ",curpos);
	oper=FindOper(str);
	if(!oper) 
	{
		AfxMessageBox(ins+"  '"+str+"' Unknown operator");
		return false;
	}
	str=ins.Tokenize(" ",curpos);
	if(str[0]!='$')
	{
		addr=false;
		data=atoi((PCSTR)str);
	}
	else
	{
		addr=true;
		data=atoi((PCSTR)str+1);
		if(data>=32)
		{
			AfxMessageBox(ins+"  Over the limited address"); 
			return false;
		}
	}
	str=ins.Tokenize(" ",curpos);
	if(str!="")
	{
		AfxMessageBox(ins+" Unexpected end of line");
		return false;
	}
	return false;
}

⌨️ 快捷键说明

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