diff --git a/MixAssembler/Assembler.cs b/MixAssembler/Assembler.cs index 5359c3b..d109412 100644 --- a/MixAssembler/Assembler.cs +++ b/MixAssembler/Assembler.cs @@ -51,10 +51,8 @@ public static InstructionInstanceBase[] Assemble(string[] sourceLines, out PreIn list.Add(instructionInstance); - if (instructionInstance != null && instructionInstance.Instruction is LoaderInstruction) + if (instructionInstance != null && instructionInstance.Instruction is LoaderInstruction loaderInstruction) { - var loaderInstruction = (LoaderInstruction)instructionInstance.Instruction; - if (loaderInstruction.Operation == LoaderInstruction.Operations.SetLocationCounter) { status.LocationCounter = (int)((LoaderInstruction.Instance)instructionInstance).Value.LongValue; diff --git a/MixAssembler/Instruction/MixInstructionParameters.cs b/MixAssembler/Instruction/MixInstructionParameters.cs index 0398541..40d9592 100644 --- a/MixAssembler/Instruction/MixInstructionParameters.cs +++ b/MixAssembler/Instruction/MixInstructionParameters.cs @@ -171,14 +171,14 @@ public static IInstructionParameters ParseAddressField(InstructionBase instructi return null; } - var index = IPartValue.ParseValue(addressField.Substring(indexCharIndex, sectionCharIndex - indexCharIndex), indexCharIndex, status); + var index = IPartValue.ParseValue(addressField[indexCharIndex..sectionCharIndex], indexCharIndex, status); if (index == null) { status.ReportParsingError(indexCharIndex, sectionCharIndex - indexCharIndex, "unable to parse index"); return null; } - var field = FPartValue.ParseValue(addressField.Substring(sectionCharIndex), sectionCharIndex, status); + var field = FPartValue.ParseValue(addressField[sectionCharIndex..], sectionCharIndex, status); if (field == null) { status.ReportParsingError(sectionCharIndex, addressField.Length - sectionCharIndex, "unable to parse field"); diff --git a/MixAssembler/MixAssembler.csproj b/MixAssembler/MixAssembler.csproj index c2adddf..27f5b90 100644 --- a/MixAssembler/MixAssembler.csproj +++ b/MixAssembler/MixAssembler.csproj @@ -1,4 +1,4 @@ - + net5.0-windows Library @@ -16,11 +16,6 @@ - - - - - all diff --git a/MixAssembler/Parser.cs b/MixAssembler/Parser.cs index 89f8f20..b481ac5 100644 --- a/MixAssembler/Parser.cs +++ b/MixAssembler/Parser.cs @@ -24,8 +24,8 @@ public static class Parser const int addressFieldIndex = 2; const int commentFieldIndex = 3; - static readonly InstructionSet mInstructionSet = new InstructionSet(); - static readonly LoaderInstructions mLoaderInstructions = new LoaderInstructions(); + static readonly InstructionSet mInstructionSet = new(); + static readonly LoaderInstructions mLoaderInstructions = new(); static bool IsCommentLine(string sourceLine) { @@ -283,7 +283,7 @@ static string[] SplitLine(string sourceLine) var opFieldEnd = FindFirstWhiteSpace(sourceLine, opFieldStart); if (opFieldEnd == -1) { - return new string[] { sourceLine.Substring(0, searchBeyondIndex), sourceLine.Substring(opFieldStart), "", "" }; + return new string[] { sourceLine.Substring(0, searchBeyondIndex), sourceLine[opFieldStart..], "", "" }; } int opFieldLength = opFieldEnd - opFieldStart; @@ -312,7 +312,7 @@ static string[] SplitLine(string sourceLine) if (addressFieldEnd == -1) { - return new string[] { sourceLine.Substring(0, searchBeyondIndex), sourceLine.Substring(opFieldStart, opFieldLength), sourceLine.Substring(addressFieldStart), "" }; + return new string[] { sourceLine.Substring(0, searchBeyondIndex), sourceLine.Substring(opFieldStart, opFieldLength), sourceLine[addressFieldStart..], "" }; } int addressFieldLength = addressFieldEnd - addressFieldStart; @@ -322,7 +322,7 @@ static string[] SplitLine(string sourceLine) return new string[] { sourceLine.Substring(0, searchBeyondIndex), sourceLine.Substring(opFieldStart, opFieldLength), sourceLine.Substring(addressFieldStart, addressFieldLength), "" }; } - return new string[] { sourceLine.Substring(0, searchBeyondIndex), sourceLine.Substring(opFieldStart, opFieldLength), sourceLine.Substring(addressFieldStart, addressFieldLength), sourceLine.Substring(commentFieldStart) }; + return new string[] { sourceLine.Substring(0, searchBeyondIndex), sourceLine.Substring(opFieldStart, opFieldLength), sourceLine.Substring(addressFieldStart, addressFieldLength), sourceLine[commentFieldStart..] }; } } } diff --git a/MixAssembler/Properties/launchSettings.json b/MixAssembler/Properties/launchSettings.json index 2ee2dd2..0535482 100644 --- a/MixAssembler/Properties/launchSettings.json +++ b/MixAssembler/Properties/launchSettings.json @@ -8,13 +8,6 @@ } }, "profiles": { - "IIS Express": { - "commandName": "IISExpress", - "launchBrowser": true, - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - } - }, "MixAssembler": { "commandName": "Project", "launchBrowser": true, diff --git a/MixAssembler/Symbol/LiteralConstantSymbol.cs b/MixAssembler/Symbol/LiteralConstantSymbol.cs index 7cb64b8..15434c8 100644 --- a/MixAssembler/Symbol/LiteralConstantSymbol.cs +++ b/MixAssembler/Symbol/LiteralConstantSymbol.cs @@ -55,12 +55,12 @@ static string GetName(Word.Signs literalSign, long literalMagnitude, int count) public static IValue ParseValue(string text, int sectionCharIndex, ParsingStatus status) { - if (text.Length < 2 || text[0] != '=' || text[text.Length - 1] != '=') + if (text.Length < 2 || text[0] != '=' || text[^1] != '=') { return null; } - var expressionValue = WValue.ParseValue(text.Substring(1, text.Length - 2), sectionCharIndex + 1, status); + var expressionValue = WValue.ParseValue(text[1..^1], sectionCharIndex + 1, status); if (expressionValue == null) { return null; diff --git a/MixAssembler/Symbol/LocalSymbol.cs b/MixAssembler/Symbol/LocalSymbol.cs index fc6f364..7822a74 100644 --- a/MixAssembler/Symbol/LocalSymbol.cs +++ b/MixAssembler/Symbol/LocalSymbol.cs @@ -31,11 +31,6 @@ public override void SetValue(long value) mAddresses.Add(value); } - static bool IsBackwardReferenceChar(char c) - { - return c == 'B'; - } - static bool IsDefinitionChar(char c) { return c == 'H'; @@ -53,7 +48,7 @@ static bool IsLocalSymbol(string text) static bool IsLocalSymbolChar(char c) { - return "BHF".IndexOf(c) >= 0; + return "BHF".Contains(c); } public override bool IsValueDefined(int currentAddress) @@ -181,11 +176,10 @@ public bool IsValueDefined(int currentAddress) /// public long GetValue(int currentAddress) { - long previousAddress = -1L; long followingAddress = -1L; foreach (long refereeAddress in mReferee.Addresses) { - previousAddress = followingAddress; + long previousAddress = followingAddress; followingAddress = refereeAddress; if (mDirection == Directions.Backwards && followingAddress >= currentAddress) diff --git a/MixAssembler/Symbol/SymbolBase.cs b/MixAssembler/Symbol/SymbolBase.cs deleted file mode 100644 index 2a8a62a..0000000 --- a/MixAssembler/Symbol/SymbolBase.cs +++ /dev/null @@ -1,76 +0,0 @@ -namespace MixAssembler.Symbol -{ - using MixAssembler.Value; - using System; - using MixLib.Type; - - public abstract class SymbolBase : IValue - { - private string mName; - - protected SymbolBase(string name) - { - mName = name; - } - - public abstract long GetValue(int currentAddress); - - public abstract bool IsValueDefined(int currentAddress); - - public abstract void SetValue(long value); - - public abstract void SetValue(Word.Signs sign, long magnitude); - - public virtual bool IsMultiValuedSymbol - { - get - { - return false; - } - } - - public abstract bool IsSymbolDefined - { - get; - } - - public virtual long MemoryWordValue - { - get - { - return 0L; - } - } - - public virtual long MemoryWordMagnitude - { - get - { - return 0L; - } - } - - public virtual Word.Signs MemoryWordSign - { - get - { - return Word.Signs.Positive; - } - } - - public string Name - { - get - { - return mName; - } - } - - #region IValue Members - - public abstract long GetMagnitude(int currentAddress); - public abstract Word.Signs GetSign(int currentAddress); - - #endregion - } -} diff --git a/MixAssembler/Symbol/SymbolCollection.cs b/MixAssembler/Symbol/SymbolCollection.cs deleted file mode 100644 index 93cc14a..0000000 --- a/MixAssembler/Symbol/SymbolCollection.cs +++ /dev/null @@ -1,78 +0,0 @@ -namespace MixAssembler.Symbol -{ - using System; - using System.Collections; - using System.Collections.Generic; - using System.Reflection; - - public class SymbolCollection : IEnumerable, IEnumerable - { - private SortedList mList = new SortedList(); - - public void Add(SymbolBase value) - { - if (Contains(value)) - { - throw new ArgumentException("symbol already exists", "value"); - } - - mList.Add(value.Name, value); - } - - public bool Contains(SymbolBase value) - { - return Contains(value.Name); - } - - public bool Contains(string value) - { - return mList.ContainsKey(value); - } - - private IEnumerator getEnumerator() - { - return mList.Values.GetEnumerator(); - } - - public void Remove(SymbolBase value) - { - Remove(value.Name); - } - - public void Remove(string name) - { - mList.Remove(name); - } - - IEnumerator IEnumerable.GetEnumerator() - { - return getEnumerator(); - } - - IEnumerator IEnumerable.GetEnumerator() - { - return getEnumerator(); - } - - public int Count - { - get - { - return mList.Count; - } - } - - public SymbolBase this[string name] - { - get - { - if (!mList.ContainsKey(name)) - { - return null; - } - - return mList[name]; - } - } - } -} diff --git a/MixAssembler/Value/IValue.cs b/MixAssembler/Value/IValue.cs deleted file mode 100644 index 1fb2291..0000000 --- a/MixAssembler/Value/IValue.cs +++ /dev/null @@ -1,13 +0,0 @@ -namespace MixAssembler.Value -{ - using System; - using MixLib.Type; - - public interface IValue - { - long GetValue(int currentAddress); - bool IsValueDefined(int currentAddress); - long GetMagnitude(int currentAddress); - Word.Signs GetSign(int currentAddress); - } -} diff --git a/MixEmul/Components/INavigableWordEditor.cs b/MixEmul/Components/INavigableWordEditor.cs deleted file mode 100644 index 8d14182..0000000 --- a/MixEmul/Components/INavigableWordEditor.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Windows.Forms; - -namespace MixGui.Components -{ - interface INavigableControl - { - event KeyEventHandler NavigationKeyDown; - } -} diff --git a/MixEmul/Components/SourceAndFindingsForm.cs b/MixEmul/Components/SourceAndFindingsForm.cs index d62cec3..74055d4 100644 --- a/MixEmul/Components/SourceAndFindingsForm.cs +++ b/MixEmul/Components/SourceAndFindingsForm.cs @@ -4,7 +4,6 @@ using MixLib.Instruction; using MixLib.Misc; using System; -using System.ComponentModel; using System.Windows.Forms; namespace MixGui.Components @@ -54,7 +53,7 @@ void InitializeComponent() // mStatusStrip // this.mStatusStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.mToolStripStatusLabel}); + this.mToolStripStatusLabel}); this.mStatusStrip.Location = new System.Drawing.Point(0, 383); this.mStatusStrip.Name = "mStatusStrip"; this.mStatusStrip.Size = new System.Drawing.Size(568, 22); @@ -111,9 +110,9 @@ void InitializeComponent() // // mFindingListView // - this.mFindingListView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); + this.mFindingListView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); this.mFindingListView.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.mFindingListView.Location = new System.Drawing.Point(0, 0); this.mFindingListView.Name = "mFindingListView"; diff --git a/MixEmul/Documentation/Changes.txt b/MixEmul/Documentation/Changes.txt index d1c1381..8b45c16 100644 --- a/MixEmul/Documentation/Changes.txt +++ b/MixEmul/Documentation/Changes.txt @@ -9,6 +9,11 @@ x: Bugfix ========================================= +0.4.7752.30280 (2021-03-23) +* Migrated to .NET 5.0 +* Applied visual changes, of which enabling visual styles is the most noticeable +x Multiple small bugfixes, mainly in project/solution structure and builds + 0.3.7512.22699 * Applied flat-style visual appearance throughout MixEmul x Fixed regression in this change list diff --git a/MixEmul/MixEmul.csproj b/MixEmul/MixEmul.csproj index 96118c5..481a4dc 100644 --- a/MixEmul/MixEmul.csproj +++ b/MixEmul/MixEmul.csproj @@ -3,148 +3,37 @@ net5.0-windows WinExe MixGui.MixForm - - MixFormIcon.ico MixGui - C:\Users\rutge\source\repos\MixEmul\publish\ - true - Disk - false - Background - 7 - Days - false - false - true - 6 - 1.0.0.%2a - false - true - true false true true false - - - 56D8CA9FA393373C43CE6348BF765712A89A78AE - - - MixEmul_3_TemporaryKey.pfx - - true - - true - - - UserControl - - - UserControl - - - Component - - - UserControl - - - UserControl - - - UserControl - - - UserControl - - - UserControl - - - UserControl - - - UserControl - - - UserControl - - - UserControl - - - Component - - - UserControl - - - Component - - - Component - - - UserControl - - - UserControl - - - Component - - - UserControl - - - UserControl - - - UserControl - - - UserControl - - - Component - - - UserControl - - - UserControl - - - UserControl - + + + + + + + + + - - - False - .NET Framework 3.5 SP1 Client Profile - false - - - False - .NET Framework 2.0 - true - - - False - .NET Framework 3.5 SP1 - false - - + + PreserveNewest + + + PreserveNewest + Always @@ -152,9 +41,27 @@ Always - - - + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + diff --git a/MixEmul/Properties/AssemblyInfo.cs b/MixEmul/Properties/AssemblyInfo.cs index 64ecda4..653c595 100644 --- a/MixEmul/Properties/AssemblyInfo.cs +++ b/MixEmul/Properties/AssemblyInfo.cs @@ -28,5 +28,5 @@ // Build Number // Revision // -[assembly: AssemblyVersion("0.3.*")] -[assembly: AssemblyFileVersion("0.3")] +[assembly: AssemblyVersion("0.4.*")] +[assembly: AssemblyFileVersion("0.4")] diff --git a/MixEmul/Properties/PublishProfiles/FolderProfile.pubxml b/MixEmul/Properties/PublishProfiles/FolderProfile.pubxml new file mode 100644 index 0000000..210e98e --- /dev/null +++ b/MixEmul/Properties/PublishProfiles/FolderProfile.pubxml @@ -0,0 +1,14 @@ + + + + + Release + Any CPU + bin\publish\ + FileSystem + net5.0-windows + false + + \ No newline at end of file diff --git a/MixEmul/Properties/launchSettings.json b/MixEmul/Properties/launchSettings.json index f90c1ed..6836274 100644 --- a/MixEmul/Properties/launchSettings.json +++ b/MixEmul/Properties/launchSettings.json @@ -8,13 +8,6 @@ } }, "profiles": { - "IIS Express": { - "commandName": "IISExpress", - "launchBrowser": true, - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - } - }, "MixEmul": { "commandName": "Project", "launchBrowser": true, diff --git a/MixEmul/Settings/Configuration.cs b/MixEmul/Settings/Configuration.cs index d82149c..2a699a6 100644 --- a/MixEmul/Settings/Configuration.cs +++ b/MixEmul/Settings/Configuration.cs @@ -111,7 +111,7 @@ public static Configuration Load(string directory) return JsonSerializer.Deserialize(File.ReadAllBytes(path)); } } - catch (Exception) {} + catch (Exception) { } return new Configuration(); } diff --git a/MixLib/MixLib.csproj b/MixLib/MixLib.csproj index 2751890..22ead27 100644 --- a/MixLib/MixLib.csproj +++ b/MixLib/MixLib.csproj @@ -1,4 +1,4 @@ - + net5.0-windows Library @@ -13,9 +13,6 @@ - - - all diff --git a/MixLib/Properties/launchSettings.json b/MixLib/Properties/launchSettings.json index f37cfc5..1229b99 100644 --- a/MixLib/Properties/launchSettings.json +++ b/MixLib/Properties/launchSettings.json @@ -8,13 +8,6 @@ } }, "profiles": { - "IIS Express": { - "commandName": "IISExpress", - "launchBrowser": true, - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - } - }, "MixLib": { "commandName": "Project", "launchBrowser": true, diff --git a/MixLib/Type/SymbolCollection.cs b/MixLib/Type/SymbolCollection.cs index 057e6a7..c7f24a0 100644 --- a/MixLib/Type/SymbolCollection.cs +++ b/MixLib/Type/SymbolCollection.cs @@ -6,7 +6,7 @@ namespace MixLib.Type { public sealed class SymbolCollection : IEnumerable, IEnumerable { - readonly SortedList mList = new SortedList(); + readonly SortedList mList = new(); public int Count => mList.Count; diff --git a/MixLib/WordField.cs b/MixLib/WordField.cs deleted file mode 100644 index 4c4da04..0000000 --- a/MixLib/WordField.cs +++ /dev/null @@ -1,114 +0,0 @@ -namespace MixLib -{ - using MixLib.Type; - using System; - - public class WordField : Word - { - private FieldSpec mFieldSpec; - - private WordField(FieldSpec fieldSpec, int byteCount) - : base(byteCount) - { - mFieldSpec = fieldSpec; - } - - public void ApplyToFullWord(FullWord word) - { - int byteCount = mFieldSpec.ByteCount; - int lowBoundByteIndex = mFieldSpec.LowBoundByteIndex; - - for (int i = 0; i < byteCount; i++) - { - word[lowBoundByteIndex + i] = base[i]; - } - - if (mFieldSpec.IncludesSign) - { - word.Sign = base.Sign; - } - } - - public void ApplyToRegister(Register register) - { - int fieldSpecByteCount = mFieldSpec.ByteCount; - if (fieldSpecByteCount > register.ByteCountWithPadding) - { - throw new ArgumentOutOfRangeException("register", register, "bytecount too large for this register"); - } - - int paddingByteCount = register.ByteCount - fieldSpecByteCount; - for (int i = 0; i < paddingByteCount; i++) - { - register[i] = 0; - } - - int fromWordByteCount = Math.Max(0, -paddingByteCount); - fieldSpecByteCount--; - - while (fieldSpecByteCount >= fromWordByteCount) - { - register[paddingByteCount + fieldSpecByteCount] = base[fieldSpecByteCount]; - fieldSpecByteCount--; - } - - register.Sign = base.Sign; - } - - public int CompareTo(FullWord toCompare) - { - WordField field = LoadFromFullWord(mFieldSpec, toCompare); - - long wordValue = base.LongValue; - long fieldValue = field.LongValue; - - return wordValue.CompareTo(fieldValue); - } - - public static WordField LoadFromFullWord(FieldSpec fieldSpec, FullWord word) - { - int fieldSpecByteCount = fieldSpec.ByteCount; - - WordField field = new WordField(fieldSpec, fieldSpecByteCount); - int lowBoundByteIndex = fieldSpec.LowBoundByteIndex; - - for (int i = 0; i < fieldSpecByteCount; i++) - { - field[i] = word[lowBoundByteIndex + i]; - } - - if (fieldSpec.IncludesSign) - { - field.Sign = word.Sign; - } - - return field; - } - - public static WordField LoadFromRegister(FieldSpec fieldSpec, Register register) - { - int fieldSpecByteCount = fieldSpec.ByteCount; - if (fieldSpecByteCount > register.ByteCountWithPadding) - { - throw new ArgumentOutOfRangeException("fieldSpec", fieldSpec, "bytecount too large for this register"); - } - - WordField field = new WordField(fieldSpec, fieldSpecByteCount); - int fromRegisterStartIndex = register.ByteCountWithPadding - fieldSpecByteCount; - fieldSpecByteCount--; - - while (fieldSpecByteCount >= 0) - { - field[fieldSpecByteCount] = register.GetByteWithPadding(fromRegisterStartIndex + fieldSpecByteCount); - fieldSpecByteCount--; - } - - if (fieldSpec.IncludesSign) - { - field.Sign = register.Sign; - } - - return field; - } - } -}