Hexadecimal instruction parsing hotfix
This commit is contained in:
@@ -22,7 +22,8 @@ namespace processor
|
||||
/// <returns></returns>
|
||||
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 "";
|
||||
}
|
||||
|
||||
@@ -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
|
||||
/// <param name="codes"></param>
|
||||
private void LoadHexCode(List<string> codes)
|
||||
{
|
||||
codes = (from x in codes select RemoveLeading(x)).ToList();
|
||||
int j = 0;
|
||||
for (int i = 0; i < codes.Count; i++)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user