Example #1
0
        private void editASMDirArt_TextChanged(object sender, EventArgs e)
        {
            Parser.ASMFileParser asmParser = new C64Studio.Parser.ASMFileParser();

            Parser.CompileConfig config = new Parser.CompileConfig();
            config.TargetType = Types.CompileTargetType.PLAIN;
            config.OutputFile = "temp.bin";
            config.Assembler  = Types.AssemblerType.C64_STUDIO;

            string temp = "* = $0801\n" + editASMDirArt.Text;

            if ((asmParser.Parse(temp, null, config, null)) &&
                (asmParser.Assemble(config)))
            {
                GR.Memory.ByteBuffer data = asmParser.AssembledOutput.Assembly;

                ResultingData = data;

                labelASMInfo.Text      = "Data is valid";
                labelASMInfo.ForeColor = System.Drawing.SystemColors.ControlText;
            }
            else
            {
                labelASMInfo.Text      = "Invalid ASM Data (expect !byte statements)";
                labelASMInfo.ForeColor = System.Drawing.Color.Red;
            }
        }
Example #2
0
        private void btnImportFromASM_Click(object sender, EventArgs e)
        {
            var parser = new Parser.ASMFileParser();

            Parser.CompileConfig config = new Parser.CompileConfig();
            config.TargetType = Types.CompileTargetType.PLAIN;
            config.OutputFile = "temp.bin";
            config.Assembler  = Types.AssemblerType.C64_STUDIO;

            string temp = "* = $0801\n" + editDataExport.Text;


            if ((!parser.Parse(temp, new ProjectConfig(), config)) ||
                (!parser.Assemble(config)))
            {
                return;
            }
            var output = parser.AssembledOutput;

            m_Project.ValueTable.Data.Clear();
            m_Project.ValueTable.Values.Clear();
            listValues.Items.Clear();

            for (int i = 0; i < output.Assembly.Length; ++i)
            {
                byte nextValue = output.Assembly.ByteAt(i);
                m_Project.ValueTable.Values.Add(nextValue.ToString());
                m_Project.ValueTable.Data.AppendU8(nextValue);
                listValues.Items.Add(nextValue.ToString());
            }
            SetModified();
        }
Example #3
0
        private void btnFromASM_Click(object sender, EventArgs e)
        {
            Parser.ASMFileParser asmParser = new C64Studio.Parser.ASMFileParser();

            Parser.CompileConfig config = new Parser.CompileConfig();
            config.TargetType = Types.CompileTargetType.PLAIN;
            config.OutputFile = "temp.bin";
            config.Assembler  = Types.AssemblerType.C64_STUDIO;

            string temp = "* = $0801\n" + textBinaryData.Text;

            if ((asmParser.Parse(temp, null, config, null)) &&
                (asmParser.Assemble(config)))
            {
                SetHexData(asmParser.AssembledOutput.Assembly);
            }
        }
Example #4
0
        private void btnImportFromAssembly_Click(object sender, EventArgs e)
        {
            Parser.ASMFileParser asmParser = new C64Studio.Parser.ASMFileParser();

            Parser.CompileConfig config = new Parser.CompileConfig();
            config.TargetType = Types.CompileTargetType.PLAIN;
            config.OutputFile = "temp.bin";
            config.Assembler  = Types.AssemblerType.C64_STUDIO;

            string temp = "* = $0801\n" + editDataImport.Text;

            if ((asmParser.Parse(temp, null, config, null)) &&
                (asmParser.Assemble(config)))
            {
                ImportFromData(asmParser.AssembledOutput.Assembly, checkImportSwizzle.Checked, checkImportColorsSorted.Checked);
            }
        }
Example #5
0
        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 == C64Studio.Types.AssemblerType.AUTO)
            {
                // try to detect -> modifying passed in Config!!
                Config.Assembler = DetectAssemblerType(text);
            }
            if (Config.Assembler == C64Studio.Types.AssemblerType.AUTO)
            {
                // safety fallback to avoid crashes
                Config.Assembler = C64Studio.Types.AssemblerType.C64_STUDIO;
            }

            m_CompileConfig = Config;
            return(Parse(text, Configuration, Config, AdditionalPredefines));
        }
Example #6
0
        private void btnImportCharsetFromASM_Click(object sender, EventArgs e)
        {
            Parser.ASMFileParser asmParser = new C64Studio.Parser.ASMFileParser();

            Parser.CompileConfig config = new Parser.CompileConfig();
            config.TargetType = Types.CompileTargetType.PLAIN;
            config.OutputFile = "temp.bin";
            config.Assembler  = Types.AssemblerType.C64_STUDIO;

            string temp = "* = $0801\n" + editDataImport.Text;

            if ((asmParser.Parse(temp, null, config, null)) &&
                (asmParser.Assemble(config)))
            {
                GR.Memory.ByteBuffer charData = asmParser.AssembledOutput.Assembly;

                ImportFromData(charData);
            }
        }
Example #7
0
 public abstract bool Parse(string Content, ProjectConfig Configuration, CompileConfig Config, string AdditionalPredefines);
Example #8
0
 public abstract bool Assemble(CompileConfig Config);
Example #9
0
 public abstract bool Parse(string Content, ProjectConfig Configuration, CompileConfig Config);