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

📄 instruction.cc

📁 Linux下比较早的基于命令行的DVD播放器
💻 CC
📖 第 1 页 / 共 2 页
字号:
      case Operand2::VTSM:        fprintf(f, "VTSM ");        if (isJump) {            fprintf(f, "%u, %u, ", operand2.getVTS(), operand1.getTTN());        }        fprintf(f, "%u", operand2.getMenu());        break;      case Operand2::VMGM_PGCN:        fprintf(f, "VMGM_PGCN %u", operand1.getPGCN());        break;      default:        fprintf(f, "<Invalid jump/call type: %u>",                 (unsigned)operand2.getJumpCallType());        break;    }}//------------------------------------------------------------------------------void Instruction::printJumpSS(FILE* f) const{    fprintf(f, "JumpSS ");    printJumpCallSS(f, true);}//------------------------------------------------------------------------------void Instruction::printCallSS(FILE* f) const{    fprintf(f, "CallSS ");    printJumpCallSS(f, false);    fprintf(f, ", cell=%u", operand2.getRSMCell());}//------------------------------------------------------------------------------void Instruction::printSetSysReg(FILE* f) const{    bool hasCondition = printSetSysRegCondition(f);        if (hasCondition) fprintf(f, "( ");    bool wasArgument = false;    switch(getSetType()) {      case STN:        fprintf(f, "SetSTN ");        if (operand1.isAF()) {            if (isDirect()) fprintf(f, "audio=%04x", operand1.getAVAL());            else fprintf(f, "audio=GPR[%02x]", operand1.getSR1());            wasArgument = true;        }        if (operand2.isSF()) {            if (wasArgument) fprintf(f, ", ");            if (isDirect()) fprintf(f, "spu=%04x", operand2.getSVAL());            else fprintf(f, "spu=GPR[%02x]", operand2.getSR2());            wasArgument = true;        }        if (operand2.isNF()) {            if (wasArgument) fprintf(f, ", ");            if (isDirect()) fprintf(f, "angle=%04x", operand2.getNVAL());            else fprintf(f, "angle=GPR[%02x]", operand2.getSR3());        }        break;      case NVTMR:        fprintf(f, "SetNVTMR ");        if (isDirect()) fprintf(f, "0x%04x", operand1.getSVAL());        else printRegister(f, operand1.getSRS());                fprintf(f, ", %u", operand2.getPGCN());        break;      case GPRMMD:        fprintf(f, "SetGPRMMD GRP[%02x], ", operand2.getSRD());        if (isDirect()) fprintf(f, "0x%04x", operand1.getSVAL());        else printRegister(f, operand1.getSRS());                if (operand2.isMF()) fprintf(f, ", setCounter");        else fprintf(f, ", clearCounter");        break;      case AMXMD:        fprintf(f, "SetAMXMD ");                if (isDirect()) {            fprintf(f, "0x%04x", operand2.getSVAL());        } else {            fprintf(f, "GPR[%02x]", operand2.getSRS());        }        break;      case HL_BTNN:        fprintf(f, "SetHL_BTNN ");                if (isDirect()) {            fprintf(f, "0x%04x", operand2.getValue());        } else {            fprintf(f, "GPR[%02x]", operand2.getSRS());        }        break;      default:        fprintf(f, "<Invalid set type: %u>",                 (unsigned)getSetType());        return;    }    if (getLinkCmd()!=LINK_NOP) {        fprintf(f, "; ");        printLinkUnconditionally(f);    }    if (hasCondition) fprintf(f, " )");}//------------------------------------------------------------------------------void Instruction::printSet(FILE* f) const{    bool hasCondition = printSetCondition(f);        if (hasCondition) fprintf(f, "( ");        printSet(f, operand1.getSRD(),             isDirect(),             isDirect() ? operand2.getValue() : operand2.getSRS());    if (getLinkCmd()!=LINK_NOP) {        fprintf(f, "; ");        printLinkUnconditionally(f);    }        if (hasCondition) fprintf(f, " )");}//------------------------------------------------------------------------------void Instruction::printSet(FILE* f, unsigned value1,                            bool isDir, unsigned value2) const{    fprintf(f, "GPR[%02x]", value1);    switch(getSetOp()) {      case Instruction::MOV:        fprintf(f, "=");        break;      case Instruction::SWP:        if (!isDir) {            fprintf(f, "<->");        } else {            fprintf(f, "<SWAP instruction with no source register>");        }        break;      case Instruction::ADD:        fprintf(f, "+=");        break;      case Instruction::SUB:        fprintf(f, "-=");        break;      case Instruction::MUL:        fprintf(f, "*=");        break;      case Instruction::DIV:        fprintf(f, "/=");        break;      case Instruction::MOD:        fprintf(f, "%%=");        break;      case Instruction::RND:        fprintf(f, "= rnd ");        break;      case Instruction::AND:        fprintf(f, "&=");        break;      case Instruction::OR:        fprintf(f, "|=");        break;      case Instruction::XOR:        fprintf(f, "^=");        break;      case Instruction::SET_NONE:        return;      default:        fprintf(f, "<Invalid set operation: %u>",                 (unsigned)getSetOp());    }    if (isDir) {        fprintf(f, "0x%04x", value2);    } else {        printRegister(f, value2);    }}//------------------------------------------------------------------------------void Instruction::printSetCLnk(FILE* f) const{    if (printSetWithLink(f)) {        fprintf(f, "; ");    }    printSetCLnkCondition(f);    printLinkSubset(f);}//------------------------------------------------------------------------------bool Instruction::printSetWithLink(FILE* f) const{    if (getSetOp()==Instruction::SET_NONE) return false;    printSet(f, getSRD(),              isDirect(),             isDirect() ? operand1.getSVAL() : operand1.getSRS());    return true;}//------------------------------------------------------------------------------void Instruction::printCSetCLnk(FILE* f) const{    bool hasCondition = printCSetCLnkCondition(f);        if (hasCondition) fprintf(f, "( ");    if (printSetWithLink(f)) {        fprintf(f, "; ");    }    printLinkSubset(f);        if (hasCondition) fprintf(f, " )");}//------------------------------------------------------------------------------void Instruction::printCmpSetLnk(FILE* f) const{    printCmpSetLnkCondition(f);    printSetWithLink(f);    fprintf(f, "; ");        printLinkSubset(f);}//------------------------------------------------------------------------------//------------------------------------------------------------------------------bool Instruction::printConditionV1(FILE* f) const{    return printCondition(f, getCmpOp(), operand1.getCR1(),                          isCmpDirect(),                           isCmpDirect() ? operand2.getValue() : operand2.getCR2());}//------------------------------------------------------------------------------bool Instruction::printConditionV2(FILE* f) const{    return printCondition(f, getCmpOp(),                          operand3.getCR1(), false, operand3.getCR2());}//------------------------------------------------------------------------------bool Instruction::printConditionV3(FILE* f) const{    return printCondition(f, getCmpOp(),                          operand1.getSetCR1(),                           isCmpDirect(),                          isCmpDirect() ? operand3.getCVAL() : operand3.getCR2());}//------------------------------------------------------------------------------bool Instruction::printConditionV4(FILE* f) const{    return printCondition(f, getCmpOp(),                          getCR1(),                           isCmpDirect(),                          isCmpDirect() ? operand2.getCVAL() : operand2.getCR2());}//------------------------------------------------------------------------------bool Instruction::printSpecialCondition(FILE* f) const{    return printConditionV1(f);}//------------------------------------------------------------------------------bool Instruction::printLinkCondition(FILE* f) const{    return printConditionV1(f);}//------------------------------------------------------------------------------bool Instruction::printJumpCallCondition(FILE* f) const{    return printConditionV2(f);}//------------------------------------------------------------------------------bool Instruction::printSetSysRegCondition(FILE* f) const{    return printConditionV2(f);}//------------------------------------------------------------------------------bool Instruction::printSetCondition(FILE* f) const{    return printConditionV3(f);}//------------------------------------------------------------------------------bool Instruction::printSetCLnkCondition(FILE* f) const{    return printConditionV4(f);}//------------------------------------------------------------------------------bool Instruction::printCSetCLnkCondition(FILE* f) const{    return printConditionV4(f);}//------------------------------------------------------------------------------bool Instruction::printCmpSetLnkCondition(FILE* f) const{    return printConditionV4(f);}//------------------------------------------------------------------------------

⌨️ 快捷键说明

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