diff --git a/source/XSharp/XSharp/Assembler/Gen1/DataMember.cs b/source/XSharp/XSharp/Assembler/Gen1/DataMember.cs index ce31b1a..91ca965 100644 --- a/source/XSharp/XSharp/Assembler/Gen1/DataMember.cs +++ b/source/XSharp/XSharp/Assembler/Gen1/DataMember.cs @@ -21,6 +21,7 @@ public class DataMember : BaseAssemblerElement, IComparable private string Size; private string StringValue; private Type Type; + private bool isIncBin; // Hack for not to emit raw data. See RawAsm public DataMember() @@ -28,8 +29,10 @@ public DataMember() Name = "Dummy"; } - public DataMember(string aName, string aValue, bool noConvert = false) + public DataMember(string aName, string aValue, bool noConvert = false, bool isIncBin = false) { + this.isIncBin = isIncBin; + if (noConvert) { Name = aName; @@ -154,6 +157,13 @@ public override void WriteText(Assembler aAssembler, TextWriter aOutput) return; } + if(isIncBin) { + aOutput.Write(Name); + aOutput.WriteLine(":"); + aOutput.WriteLine("incbin \"" + StringValue + "\""); + return; + } + if (RawDefaultValue != null) { if (RawDefaultValue.Length == 0) diff --git a/source/XSharp/XSharp/Gen1/XS.cs b/source/XSharp/XSharp/Gen1/XS.cs index 4466a7b..96acca8 100644 --- a/source/XSharp/XSharp/Gen1/XS.cs +++ b/source/XSharp/XSharp/Gen1/XS.cs @@ -686,6 +686,10 @@ public static void DataMember(string name, string value) Assembler.Assembler.CurrentInstance.DataMembers.Add(new DataMember(name, value)); } + public static void DataMember(string name, string value, bool isIncBin) { + Assembler.Assembler.CurrentInstance.DataMembers.Add(new DataMember(name, value, true, isIncBin)); + } + public static void DataMemberBytes(string name, byte[] value) { Assembler.Assembler.CurrentInstance.DataMembers.Add(new DataMember(name, value));