Updated RemoveLeading() to use with 1x prefixes

This commit is contained in:
Ferit Yiğit BALABAN
2021-10-30 05:53:45 +03:00
parent 893817eb3a
commit 6a5f4c18e6
+3 -3
View File
@@ -16,14 +16,14 @@ namespace processor
} }
/// <summary> /// <summary>
/// Removes leading 0x prefix in hexadecimal instructions, only returning 4 char part /// Removes leading 0x or 1x prefix in hexadecimal instructions, only returning 4 char part
/// </summary> /// </summary>
/// <param name="text"></param> /// <param name="text"></param>
/// <returns></returns> /// <returns></returns>
internal static string RemoveLeading(string text) internal static string RemoveLeading(string text)
{ {
if (text.Contains("0x")) return text.Remove(0, 2); if (text.StartsWith("0x") | text.StartsWith("1x")) return text.Remove(0, 2);
MessageBox.Show("Error while parsing code:\nHexadecimal instruction codes must start with \"0x\"!", "Vole Language Parser"); 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 ""; return "";
} }