instruction.cpp
来自「一个简易的CPU模拟程序」· C++ 代码 · 共 48 行
CPP
48 行
#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 + =
减小字号Ctrl + -
显示快捷键?