diff --git a/src/Extensions.cs b/src/Extensions.cs
index 724030e..e936e7c 100644
--- a/src/Extensions.cs
+++ b/src/Extensions.cs
@@ -22,7 +22,8 @@ namespace processor
///
internal static string RemoveLeading(string text)
{
- if (text.StartsWith("0x") | text.StartsWith("1x")) return text.Remove(0, 2);
+ if (text.StartsWith("0x") || text.StartsWith("1x"))
+ return text.Remove(0, 2);
MessageBox.Show("Error while parsing code:\nHexadecimal CPU instructions must start with \"0x\" and ram write instructions must start with \"1x\"!", "Vole Language Parser");
return "";
}
diff --git a/src/MainForm.cs b/src/MainForm.cs
index 032975b..1d8ca34 100644
--- a/src/MainForm.cs
+++ b/src/MainForm.cs
@@ -143,9 +143,9 @@ namespace processor
if (radHex.Checked is true)
{
// This loads CPU instructions to RAM, starting from address 0x00 and going up to 0xFF
- LoadHexCode((from x in instructionList where x.StartsWith("0x") select x).ToList());
+ LoadHexCode((from x in instructionList where x.StartsWith("0x") select x.Remove(0, 2)).ToList());
// This executes RAM write instructions, ultimately overwriting RAM with data
- ExecuteRamWrite((from x in instructionList where x.StartsWith("1x") select x).ToList());
+ ExecuteRamWrite((from x in instructionList where x.StartsWith("1x") select x.Remove(0, 2)).ToList());
}
else
{
@@ -159,7 +159,6 @@ namespace processor
///
private void LoadHexCode(List codes)
{
- codes = (from x in codes select RemoveLeading(x)).ToList();
int j = 0;
for (int i = 0; i < codes.Count; i++)
{