diff --git a/src/HexManiac.Core/Models/Code/ThumbParser.cs b/src/HexManiac.Core/Models/Code/ThumbParser.cs index 76cecfce..5ed6070e 100644 --- a/src/HexManiac.Core/Models/Code/ThumbParser.cs +++ b/src/HexManiac.Core/Models/Code/ThumbParser.cs @@ -970,8 +970,9 @@ namespace HavenSoft.HexManiac.Core.Models.Code { list = 0; while (line.Length > 0 && template.Length > 0) { // make sure that the basic format matches where it should - while (template[0] == ' ' || template[0] == ',') template = template.Substring(1); - while (line[0] == ' ' || line[0] == '!' || line[0] == ',') line = line.Substring(1); + while (template.Length > 0 && (template[0] == ' ' || template[0] == ',')) template = template.Substring(1); + while (line.Length > 0 && (line[0] == ' ' || line[0] == '!' || line[0] == ',')) line = line.Substring(1); + if (template.Length == 0 || line.Length == 0) continue; if (template[0] == '[') { if (line[0] != '[') { if (template.StartsWith("[pc, ") && template.EndsWith("]") && labels.ResolveLabel(line) != Pointer.NULL) { diff --git a/src/HexManiac.Core/Models/Code/armReference.txt b/src/HexManiac.Core/Models/Code/armReference.txt index 49b462a3..72f4b72a 100644 --- a/src/HexManiac.Core/Models/Code/armReference.txt +++ b/src/HexManiac.Core/Models/Code/armReference.txt @@ -38,6 +38,7 @@ nv=1111 @ never 00000 # rm rd | lsl rd, rm, # @ rd = rm << # 00000 # rd rd | lsl rd, # @ rd <<= # 00001 # rm rd | lsr rd, rm, # @ rd = rm >> # +00001 # rd rd | lsr rd, # @ rd >>= # 00010 # rm rd | asr rd, rm, # @ rd = rm >>> # 0001100 rm rn rd | add rd, rn, rm @ rd = rn + rm 0001101 rm rn rd | sub rd, rn, rm @ rd = rn - rm @@ -55,6 +56,9 @@ nv=1111 @ never 0100000001 rm rd | eor rd, rm @ rd ^= rm 0100000001 rm rd | eor rd, rd, rm @ rd ^= rm 0100000001 rm rd | eor rd, rm, rd @ rd ^= rm +0100000001 rm rd | xor rd, rm @ rd ^= rm +0100000001 rm rd | xor rd, rd, rm @ rd ^= rm +0100000001 rm rd | xor rd, rm, rd @ rd ^= rm 0100000010 rs rd | lsl rd, rs @ rd <<= rs 0100000011 rs rd | lsr rd, rs @ rd >>= rs 0100000100 rs rd | asr rd, rs @ rd >>>= rs diff --git a/src/HexManiac.Tests/Before_Baseclass/ToolTests.cs b/src/HexManiac.Tests/Before_Baseclass/ToolTests.cs index c47815fd..028c8d26 100644 --- a/src/HexManiac.Tests/Before_Baseclass/ToolTests.cs +++ b/src/HexManiac.Tests/Before_Baseclass/ToolTests.cs @@ -597,10 +597,13 @@ namespace HavenSoft.HexManiac.Tests { [InlineData("r1 = 100() + 3", "bl <100>; mov r1, r0; add r1, #3")] [InlineData("r1 |= r2", "orr r1, r2")] [InlineData("r1 ^= r2", "xor r1, r2")] + [InlineData("r1 ^= r2", "eor r1, r2")] [InlineData("r1 &= r2", "and r1, r2")] [InlineData("r1 *= r2", "mul r1, r2")] [InlineData("r1 <<= r2", "lsl r1, r2")] [InlineData("r1 >>= r2", "lsr r1, r2")] + [InlineData("r1 >>= 2", "lsr r1, #2")] + [InlineData("lsr r1, #2", "lsr r1, r1, #2")] public void ThumbCode_Math_Compiles(string math, string code) { var model = new PokemonModel(new byte[0x200]); var result = parser.Compile(model, 0x100, math);