コード例 #1
0
ファイル: LM1.cs プロジェクト: AbelianGroupInc/LmInterpreter
        protected override void MasterSwitch(RichTextBox textbox)
        {
            switch (GetCurrentCommandNumber())
            {
            case CMD_RM_INPUT:
                LMCommands.InputMessage(textbox, GetName(GetAddressOperand(currentAddress, GetInOutOperand())));
                inputFlag = true;
                break;

            case CMD_RM_OUTPUT:
                LM1Operations.PerformOutputOperation(this, LMCommands.Output, textbox);
                break;

            case CMD_RM_UNSIGNED_INPUT:
                LMCommands.InputMessage(textbox, GetName(GetAddressOperand(currentAddress, GetInOutOperand())));
                uInputFlag = true;
                break;

            case CMD_RM_UNSIGNED_OUTPUT:
                LM1Operations.PerformOutputOperation(this, LMCommands.UnsignedOuput, textbox);
                break;

            case CMD_RM_ADD:
                LM1Operations.PerformArithmeticOperation(this, LMCommands.Add);
                break;

            case CMD_RR_ADD:
                LM1Operations.PerformArithmeticOperation(this, LMCommands.Add);
                break;

            case CMD_RM_SUBSRACT:
                LM1Operations.PerformArithmeticOperation(this, LMCommands.Substract);
                break;

            case CMD_RR_SUBSTRACT:
                LM1Operations.PerformArithmeticOperation(this, LMCommands.Substract);
                break;

            case CMD_RM_MULTIPLICATION:
                LM1Operations.PerformArithmeticOperation(this, LMCommands.Multiplication);
                break;

            case CMD_RR_MULTIPLICATION:
                LM1Operations.PerformArithmeticOperation(this, LMCommands.Multiplication);
                break;

            case CMD_RM_DIVISION:
                LM1Operations.PerformDivisionOperation(this, LMCommands.Division, LMCommands.Module);
                break;

            case CMD_RR_DIVISION:
                LM1Operations.PerformDivisionOperation(this, LMCommands.Division, LMCommands.Module);
                break;

            case CMD_RM_UNSIGNED_MULTIPLICATION:
                LM1Operations.PerformArithmeticOperation(this, LMCommands.UnsignedMultiplication);
                break;

            case CMD_RR_UNSIGNED_MULTIPLICATION:
                LM1Operations.PerformArithmeticOperation(this, LMCommands.UnsignedMultiplication);
                break;

            case CMD_RR_UNSIGNED_DIVISION:
                LM1Operations.PerformDivisionOperation(this, LMCommands.UnsignedDivision, LMCommands.UnsignedModule);
                break;

            case CMD_RM_UNSIGNED_DIVISION:
                LM1Operations.PerformDivisionOperation(this, LMCommands.UnsignedDivision, LMCommands.UnsignedModule);
                break;

            case CMD_RM_ASSIGMENT_1:
                LM1Operations.PerformRMRRAssignmentOperation(this);
                break;

            case CMD_RM_ASSIGMENT_2:
                LM1Operations.PerformFromRInMAssignmentOperation(this);
                break;

            case CMD_RR_ASSIGMENT:
                LM1Operations.PerformRMRRAssignmentOperation(this);
                break;

            case CMD_RM_COMPARISON:
                LM1Operations.PerformFlagDetermination(this);
                break;

            case CMD_RR_COMPARISON:
                LM1Operations.PerformFlagDetermination(this);
                break;

            case CMD_LESS:
                LM1Operations.PerformComparisonOperation(this, LM1Operations.ComparisonFlag.LESS);
                break;

            case CMD_GREATER:
                LM1Operations.PerformComparisonOperation(this, LM1Operations.ComparisonFlag.GREATER);
                break;

            case CMD_LESS_OR_EQUAL:
                LM1Operations.PerformComparisonOperation(this, LM1Operations.ComparisonFlag.LESS_OR_EQUAL);
                break;

            case CMD_GREATER_OR_EQUAL:
                LM1Operations.PerformComparisonOperation(this, LM1Operations.ComparisonFlag.GREATER_OR_EQUAL);
                break;

            case CMD_EQUAL:
                LM1Operations.PerformComparisonOperation(this, LM1Operations.ComparisonFlag.EQUAL);
                break;

            case CMD_NOT_EQUAL:
                LM1Operations.PerformComparisonOperation(this, LM1Operations.ComparisonFlag.N_EQUAL);
                break;

            case CMD_UNSIGNED_LESS:
                LM1Operations.PerformComparisonOperation(this, LM1Operations.ComparisonFlag.INS_LESS);
                break;

            case CMD_UNSIGNED_GREATER:
                LM1Operations.PerformComparisonOperation(this, LM1Operations.ComparisonFlag.INS_GREATER);
                break;

            case CMD_UNSIGNED_LESS_OR_EQUAL:
                LM1Operations.PerformComparisonOperation(this, LM1Operations.ComparisonFlag.INS_LESS_OR_EQUAL);
                break;

            case CMD_UNSIGNED_GREATER_OR_EQUAL:
                LM1Operations.PerformComparisonOperation(this, LM1Operations.ComparisonFlag.INS_GREATER_OR_EQUAL);
                break;

            case CMD_GO_TO:
                LM1Operations.PerformGoToOperation(this);
                break;

            case CMD_RR_STOP:
                this.endFlag = true;
                break;

            default:
                break;
            }
        }
コード例 #2
0
ファイル: LM3.cs プロジェクト: AbelianGroupInc/LmInterpreter
        protected override void MasterSwitch(RichTextBox textbox)
        {
            switch (GetCurrentCommandNumber())
            {
            case CMD_INPUT:
                LMCommands.InputMessage(textbox, GetName(GetAddressOperand(currentAddress, 1)));
                inputFlag = true;
                break;

            case CMD_UNSIGNED_INPUT:
                LMCommands.InputMessage(textbox, GetName(GetAddressOperand(currentAddress, 1)));
                uInputFlag = true;
                break;

            case CMD_OUTPUT:
                LM3Operations.PerformOutputOperation(this, LMCommands.Output, textbox);
                break;

            case CMD_UNSIGNED_OUTPUT:
                LM3Operations.PerformOutputOperation(this, LMCommands.UnsignedOuput, textbox);
                break;

            case CMD_ADD:
                LM3Operations.PerformArithmeticOperation(this, LMCommands.Add);
                break;

            case CMD_SUBSRACT:
                LM3Operations.PerformArithmeticOperation(this, LMCommands.Substract);
                break;

            case CMD_MULTIPLICATION:
                LM3Operations.PerformArithmeticOperation(this, LMCommands.Multiplication);
                break;

            case CMD_DIVISION:
                LM3Operations.PerformDivisionOperation(this, LMCommands.Division, LMCommands.Module);
                break;

            case CMD_UNSIGNED_MULTIPLICATION:
                LM3Operations.PerformArithmeticOperation(this, LMCommands.UnsignedMultiplication);
                break;

            case CMD_UNSIGNED_DIVISION:
                LM3Operations.PerformDivisionOperation(this, LMCommands.UnsignedDivision, LMCommands.UnsignedModule);
                break;

            case CMD_ASSIGMENT:
                LM3Operations.PerformAssignmentOperation(this);
                break;

            case CMD_GOTO:
                LM3Operations.PerformGoToOperation(this);
                break;

            case CMD_LESS:
                LM3Operations.PerformComparisonOperation(this, LMCommands.Less);
                break;

            case CMD_GREATER:
                LM3Operations.PerformComparisonOperation(this, LMCommands.Greater);
                break;

            case CMD_LESS_OR_EQUAL:
                LM3Operations.PerformComparisonOperation(this, LMCommands.LessOrEqual);
                break;

            case CMD_GREATER_OR_EQUAL:
                LM3Operations.PerformComparisonOperation(this, LMCommands.GreaterOrEqual);
                break;

            case CMD_EQUAL:
                LM3Operations.PerformComparisonOperation(this, LMCommands.Equal);
                break;

            case CMD_NOT_EQUAL:
                LM3Operations.PerformComparisonOperation(this, LMCommands.NotEqual);
                break;

            case CMD_UNSIGNED_LESS:
                LM3Operations.PerformComparisonOperation(this, LMCommands.UnsignedLess);
                break;

            case CMD_UNSIGNED_GREATER:
                LM3Operations.PerformComparisonOperation(this, LMCommands.UnsignedGreater);
                break;

            case CMD_UNSIGNED_LESS_OR_EQUAL:
                LM3Operations.PerformComparisonOperation(this, LMCommands.UnsignedLessOrEqual);
                break;

            case CMD_UNSIGNED_GREATER_OR_EQUAL:
                LM3Operations.PerformComparisonOperation(this, LMCommands.UnsignedGreaterOrEqual);
                break;

            case CMD_STOP:
                endFlag = true;
                return;

            default:
                break;
            }
        }