Ejemplo n.º 1
0
        public static JMP Create(ILineInfo line)
        {
            if (line.NumberOfArguments != 1)
            {
                throw new Exceptions.ArgumentNumberException("JMP", line.NumberOfArguments);
            }
            var cmd = new JMP()
            {
                LineNumber = line.LineNumber
            };

            switch (line.TypeOfArgument(1))
            {
            case Lexer.ArgumentType.Name:
                cmd.LabelName = line.Argument(1).ToLower();
                cmd.Capture   = line.LastCapture;
                cmd.Assemble  = cmd.assemble;
                break;
            }
            if (cmd.Assemble == null)
            {
                throw new Exceptions.ArgumentException("JMP", line.TypeOfArgument(1));
            }
            return(cmd);
        }
Ejemplo n.º 2
0
        byte[] assemble(MemoryManager mgr)
        {
            if (!mgr.IsLabelDecalared(LabelName))
            {
                throw new Exceptions.LabelNotDeclaredException(LabelName, "JMP", Capture);
            }
            Int16 from = mgr.Pointer;
            Int16 to   = mgr.Labels[LabelName];

            return(JMP.Code(from, to));
        }