Package br.com.gmartins.simbler.instructions.value

Examples of br.com.gmartins.simbler.instructions.value.Value


        if (RegexMatcher.matches(regex0, getCurrentInstruction().getLineCommand())) {
            // Pega o comando na posição definida pelo numero após o @
            Instruction dest = getInstructionAt(getCurrentInstruction().getValue().toInteger());
            // Multiplica o valor definido no ADD com o valor atual de AX
            Value value = ALU.mul(getRegisters().getAx().getValue(), dest.getValue());
            // Define em AX o novo valor.
            getRegisters().getAx().setValue(value);
        } else if (RegexMatcher.matches(regex1, getCurrentInstruction().getLineCommand())) {
            // Multiplica o valor definido no ADD com o valor atual de AX
            Value value = ALU.mul(getRegisters().getAx().getValue(), getCurrentInstruction().getValue());
            // Define o novo valor no AX
            getRegisters().getAx().setValue(value);
        } else if (RegexMatcher.matches(regex2, getCurrentInstruction().getLineCommand())) {
            // Multiplica o valor do registrador definido em ADD com o valor de AX
            Value value = ALU.mul(getRegisters().getAx().getValue(), getCurrentInstruction().getRegister().getValue());
            // Define o novo valor em AX
            getRegisters().getAx().setValue(value);
        }

    }
View Full Code Here


            getMainPanel().getRegisterManager().getAx().setValue(getCurrentInstruction().getValue());
        } else if (RegexMatcher.matches(regex3, getCurrentInstruction().getLineCommand())) {
            // Pega o valor do registrador definido no comando
        
               
            Value value = getCurrentInstruction().getRegister().getValue();
            // Define o novo valor em AX
            getRegisters().getAx().setValue(value);
        
        }
View Full Code Here

        if (words.length != 0) {
            // Se for números
            if (words.length == 1 && RegexMatcher.matches(InstructionRegex.RX_NUMBERS, words[0])) {
                instruction.setMnemonic(map.get("GeneralCommands"));
                instruction.setValue(new Value(words[0], dataType));

                // Se for números, define como a posição, a posição atual da linha
                // Como posição final é definido a posição inicial + o tamanaho do comando.
                // > 123 < Ex: Início 0 Fim 3
                instruction.getValue().setValueStartPosition(0);
                instruction.getValue().setValueEndPosition(words[0].length());
                // System.out.println(line + ": Inicial " + m.getValuePosition().getCaretStartPosition() + " Final:" + m.getValuePosition().getCaretEndPosition());
                return instruction;
                // Se for linha em branco
            } else if (words.length == 1 && (words[0] == null || words[0].equals("\n") || words[0].isEmpty())) {
                instruction.setMnemonic(map.get("GeneralCommands"));
                // Coloca o valor "0" artificialmente
                instruction.setValue(ALU.decimal(0));
                instruction.setEmpty(true);
                instruction.getValue().setValueStartPosition(0);
                instruction.getValue().setValueEndPosition(0);
                return instruction;
            } else if (words.length == 1) { // Provavelmente este caso serve só para o HLT
                // Não define posições, HLT não precisa de substituições.
                instruction.setMnemonic(map.get(words[0]));
                appendExecutable(instruction);
                return instruction;
            } // Se nao for nenhum caso acima, entra nesse. (INC AX, LOAD 30, STORE BX)
            else if (words.length == 2) {
                instruction.setMnemonic(map.get(words[0]));
                instruction.setValue(new Value(words[1], dataType));
                LineValue lineValue = new LineValue();
                String completeInstruction = lineValue.getLineText(position, panel.getCodeTextArea());
                int[] valuePosition = getValuePosition(completeInstruction, words[0], words[1]);
                instruction.getValue().setValueStartPosition(valuePosition[0]);
                instruction.getValue().setValueEndPosition(valuePosition[1]);
View Full Code Here

        //REGEX[2] - "AND [ABCD]X"

        if (RegexMatcher.matches(regex0, getCurrentInstruction().getLineCommand())) {

            // Pega o valor do registrador AX
            Value value1 = getRegisters().getAx().getValue();
            // Pega o valor do comando na posição definida pelo numero após o @
            Value value2 = getInstructionAt(getCurrentInstruction().getValue()).getValue();

            // Faz o "AND" e define em AX
            getRegisters().getAx().setValue(ALU.or(value1, value2));
        } else if (RegexMatcher.matches(regex1, getCurrentInstruction().getLineCommand())) {
            // Pega o valor do registrador AX
            Value value1 = getRegisters().getAx().getValue();
            // Pega o valor da instrução atual
            Value value2 = getCurrentInstruction().getValue();
            // Faz o "AND" e define em AX
            getRegisters().getAx().setValue(ALU.or(value1, value2));
        } else if (RegexMatcher.matches(regex2, getCurrentInstruction().getLineCommand())) {
            // Pega o valor do registrador AX
            Value value1 = getRegisters().getAx().getValue();
            // Pega o valor do registrador da instrução
            Value value2 = getCurrentInstruction().getRegister().getValue();
            // Faz o "AND" e define em AX
            getRegisters().getAx().setValue(ALU.or(value1, value2));
        }

    }
View Full Code Here

TOP

Related Classes of br.com.gmartins.simbler.instructions.value.Value

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.