DCPU16_ASM.Assembler.Parser.AssembleLine C# (CSharp) Method

AssembleLine() private method

private AssembleLine ( string line ) : void
line string
return void
        private void AssembleLine(string line)
        {
            line = line.ToLower().Trim();

            if (dataNextLine != false)
            {
                dataNextLine = this.ParseDat(line);
                return;
            }

            if (line[0] == ':')
            {
                var remaiderLineContentIndex = this.ParseLabel(line);

                if (remaiderLineContentIndex <= 0)
                {
                    return;
                }

                line = line.Remove(0, remaiderLineContentIndex).Trim();

                if (line.Length < 1)
                {
                    return;
                }
            }

            var tokens = this.Tokenize(line);
            var token = tokens[0].Trim();

            if (token.ToLower() == "dat")
            {
                dataNextLine = this.ParseDat(line);
                return;
            }

            if (!this.opcodeDictionary.ContainsKey(token))
            {
                throw new Exception(string.Format("Illegal cpu opcode --> {0}", tokens[0]));
            }

            var opcode = (uint)this.opcodeDictionary[token];
            var param = tokens[1].Trim();

            if ((opcode & 0xF) > 0x0)
            {
				opcode &= 0xF;
				var param1 = tokens[2];
                GenerateInstruction(opcode, param, param1);
            }
            else
            {
                GenerateInstruction(opcode, param);
            }
        }