示例#1
0
void csPixelShaderParser::GetInstructionLine (
  const csPSProgramInstruction& instr, csString& str) const
{
  csString instrStr;
  GetInstructionString (instr, instrStr);
  str << instrStr;

  str << ' ';
  str << GetRegType (instr.dest_reg);
  str << instr.dest_reg_num;

  if (instr.dest_reg_mods != 0) str << '.';
  if (instr.dest_reg_mods & CS_PS_WMASK_RED) str << 'r';
  if (instr.dest_reg_mods & CS_PS_WMASK_GREEN) str << 'g';
  if (instr.dest_reg_mods & CS_PS_WMASK_BLUE) str << 'b';
  if (instr.dest_reg_mods & CS_PS_WMASK_ALPHA) str << 'a';

  for (int j = 0; j < 3; j++)
  {
    if (instr.src_reg[j] == CS_PS_REG_NONE) break;
    str << ", ";
    
    GetSrcRegname (instr.src_reg[j], instr.src_reg_num[j], 
	instr.src_reg_mods[j], str);
  }
}
示例#2
0
void GetCurrentInstruction(char * buffer)
{
	auto emu = PdpEmulator::IPtr();
	offset_t pc = emu->GetRegisterValue(7);
	word instrCode = *emu->GetWordFromMemory(pc);
	auto instrString = emu->GetInstructionString(instrCode, pc).first;
	auto instrStringC = instrString.c_str();
	memcpy(buffer, instrStringC, strlen(instrStringC) + 1);
}
示例#3
0
void GetInstructions(int number, char * buffer)
{
	auto emu = PdpEmulator::IPtr();
	offset_t pc = emu->GetRegisterValue(7);
	std::string instrString = "";
	int offsetToNextInstruction = 0;
	while (number-- > 0) {
		word instrCode = *emu->GetWordFromMemory(pc + offsetToNextInstruction);
		auto instructionAndOffset = emu->GetInstructionString(instrCode, pc + offsetToNextInstruction);
		instrString += instructionAndOffset.first;
		offsetToNextInstruction += instructionAndOffset.second * 2;
		if (number != 0) instrString += ";";
	}
	auto instrStringC = instrString.c_str();
	memcpy(buffer, instrStringC, strlen(instrStringC) + 1);
}