示例#1
0
        public override OperatorOutput GenerateBinary(AssemblerState assemblerState, AsmLine asmLine)
        {
            if (string.IsNullOrWhiteSpace(asmLine.Label))
            {
                assemblerState.RaiseError("IS must have a label.");
            }
            else
            {
                // TODO only integer constants and register substitutions are supported
                // register
                if (TryParseRegister(asmLine.Expr, out byte registerRef))
                {
                    assemblerState.DefineVariable(asmLine.Label, new RegisterCompilerVariable(registerRef));
                }
                // constant
                else if (int.TryParse(asmLine.Expr, out int constant))
                {
                    assemblerState.DefineVariable(asmLine.Label, new ByteConstantAssemblerVariable((byte)constant));
                }
                else
                {
                    assemblerState.RaiseError($"IS expression, '{asmLine.Expr}' must be a constant integer or register reference.");
                }
            }

            return(new OperatorOutput());
        }
示例#2
0
        public override OperatorOutput GenerateBinary(AssemblerState assemblerState, AsmLine asmLine)
        {
            // register alias
            ulong location;

            if (TryParseConstant(asmLine.Expr, out location))
            {
                assemblerState.ProgramCounter = location;
            }
            else
            {
                assemblerState.RaiseError("LOC expression must be a constant value.");
            }

            return(new OperatorOutput());
        }
示例#3
0
 public override OperatorOutput GenerateBinary(AssemblerState assemblerState, AsmLine asmLine)
 {
     assemblerState.RaiseError($"'{Symbol}' is not implemented.");
     return(new OperatorOutput());
 }