Package Hack.Controller

Examples of Hack.Controller.ProgramException


    private byte translateSegment(String segment, HVMInstructionSet instructionSet,
                                  String fileName)
     throws ProgramException {
        byte code = instructionSet.segmentVMStringToCode(segment);
        if (code == HVMInstructionSet.UNKNOWN_SEGMENT)
            throw new ProgramException(": Illegal memory segment - "
                                       + segment);

        return code;
    }
View Full Code Here


            computeExp(instruction);
            setDestination(instruction);
            pcChanged = checkJump(instruction);
        }
        else if (instruction != HackAssemblerTranslator.NOP)
            throw new ProgramException("At line " + PC.get() +
                     ": Illegal instruction");

        if (!pcChanged) {
            short newPC = (short)(PC.get() + 1);
            if (newPC < 0 || newPC >= Definitions.ROM_SIZE)
                throw new ProgramException("At line " + PC.get() +
                       ": Can't continue past last line");
            PC.setValueAt(0, newPC, true);
        }

        time++;
View Full Code Here

        // sends A or M[A] to input1 of the alu
        if (indirect) {
      int address = A.get();
      if (address < 0 || address >= M.getSize())
        throw new ProgramException("At line " + PC.get() +
                       ": Expression involves M but A=" +
                       address +
                       " is an illegal memory address.");
            A.setUpdatePointer(true);
            bus.send(M, address, alu, 1);
View Full Code Here

        boolean destM = (instruction & 0x0008) > 0;

        if (destM) {
      int address = A.get();
      if (address < 0 || address >= M.getSize())
        throw new ProgramException("At line " + PC.get() +
                       ": Destination is M but A=" +
                       address +
                       " is an illegal memory address.");
            A.setUpdatePointer(true);
      bus.send(alu, 2, M, address);
View Full Code Here

        if ((exp < 0 && jumpNegative) ||
            (exp == 0 && jumpEqual) ||
            (exp > 0 && jumpPositive)) {
      int newPC = A.get();
            if (newPC < 0 || newPC >= Definitions.ROM_SIZE)
        throw new ProgramException("At line " + PC.get() +
                       ": Jump requested but A=" + newPC +
                       " is an illegal program address.");
            bus.send(A, 0, PC, 0);
            changed = true;
        }
View Full Code Here

            notifyProgramListeners(ProgramEvent.LOAD, fileName);

        } catch (AssemblerException ae) {
            if (displayChanges)
                ((ROMGUI)gui).hideMessage();
            throw new ProgramException(ae.getMessage());
        }

    }
View Full Code Here

TOP

Related Classes of Hack.Controller.ProgramException

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.