Beispiel #1
0
        /// <summary>
        /// Constructs an instance of a <see cref="PseudoAssembler"/> line assembler.
        /// </summary>
        public PseudoAssembler()
        {
            _includedBinaries = new Dictionary <string, BinaryFile>();

            Reserved.DefineType("Types",
                                ".addr", ".align", ".binary", ".byte", ".sbyte",
                                ".dint", ".dword", ".fill", ".lint", ".long",
                                ".rta", ".sint", ".word",
                                ".cstring", ".lstring", ".nstring", ".pstring",
                                ".string"
                                );

            Evaluator.AddFunctionEvaluator(this);
        }
Beispiel #2
0
        /// <summary>
        /// Initializes the <see cref="Assembler"/> class for use. Repeated calls will reset symbol labels and variables,
        /// assembling pass and listing printing states, the binary output, and the error log.
        /// </summary>
        /// <param name="args">The command line arguments passed by the user.</param>
        public static void Initialize(string[] args)
        {
            PassChanged            = null;
            PrintOff               = false;
            PassNeeded             = true;
            _pass                  = -1;
            LineIterator           = null;
            Options                = new CommandLineOptions();
            IsReserved             = new List <Func <string, bool> >();
            InstructionLookupRules = new List <Func <string, bool> >();
            if (args != null)
            {
                Options.ParseArgs(args);
            }


            Encoding      = new AsmEncoding(Options.CaseSensitive);
            SymbolManager = new SymbolManager(Options.CaseSensitive);
            Evaluator.Initialize();
            Evaluator.AddFunctionEvaluator(SymbolManager);
            Log    = new ErrorLog();
            Output = new BinaryOutput();
        }
Beispiel #3
0
        /// <summary>
        /// Constructs a new instance of the multiline assembler class.
        /// </summary>
        public MultiLineAssembler()
        {
            _blocks = new Stack <BlockProcessorBase>();

            _functionDefs = new Dictionary <string, Function>();

            _currentBlock = null;

            Reserved.DefineType("Scope", ".block", ".endblock");

            Reserved.DefineType("Conditional",
                                ".if", ".ifdef", ".ifndef", ".else", ".elseif",
                                ".elseifdef", ".elseifndef", ".endif");

            Reserved.DefineType("SwitchCase",
                                ".switch", ".case", ".default", ".endswitch");

            Reserved.DefineType("Functional",
                                ".function", ".endfunction", ".invoke", ".return");

            Reserved.DefineType("ForNext", ".for", ".next");

            Reserved.DefineType("While", ".while", ".endwhile");

            Reserved.DefineType("Repeat", ".repeat", ".endrepeat");

            Reserved.DefineType("BreakContinue", ".break", ".continue");

            Reserved.DefineType("Page", ".page", ".endpage");

            Reserved.DefineType("GotoEnd", ".goto", ".end");

            Evaluator.AddFunctionEvaluator(this);

            Assembler.PassChanged += CheckCurrentLineAtPass;
        }