internal static ByteBuffer FromASMData(string Text) { var asmParser = new Parser.ASMFileParser(); var config = new Parser.CompileConfig(); config.TargetType = CompileTargetType.PLAIN; config.OutputFile = "temp.bin"; config.Assembler = AssemblerType.C64_STUDIO; string temp = "* = $0801\n" + Text; if (Text.Contains(".BYTE")) { config.Assembler = AssemblerType.DASM; // DASM requires pseudo ops to be not at the left most border temp = " ORG $0801\n" + Text.Replace(".BYTE", " .BYTE"); } if ((asmParser.Parse(temp, null, config, null)) && (asmParser.Assemble(config))) { return(asmParser.AssembledOutput.Assembly); } return(null); }
public bool ParseFile(string Filename, string SourceCode, ProjectConfig Configuration, CompileConfig Config, string AdditionalPredefines) { Clear(); if (string.IsNullOrEmpty(Filename)) { return(false); } m_Filename = Filename; m_DocBasePath = GR.Path.RemoveFileSpec(Filename); if (Filename.Length == 0) { return(false); } string text = SourceCode; if (string.IsNullOrEmpty(text)) { try { text = System.IO.File.ReadAllText(Filename); } catch (System.Exception) { AddError(-1, Types.ErrorCode.E2000_FILE_OPEN_ERROR, "Could not open file " + Filename); return(false); } } if (Config.Assembler == Types.AssemblerType.AUTO) { // try to detect -> modifying passed in Config!! Config.Assembler = DetectAssemblerType(text); } if (Config.Assembler == Types.AssemblerType.AUTO) { // safety fallback to avoid crashes Config.Assembler = Types.AssemblerType.C64_STUDIO; } return(Parse(text, Configuration, Config, AdditionalPredefines)); }
public abstract bool Parse(string Content, ProjectConfig Configuration, CompileConfig Config, string AdditionalPredefines);
public abstract bool Assemble(CompileConfig Config);