mirror of
https://github.com/haven1433/HexManiacAdvance.git
synced 2026-10-02 13:16:35 -05:00
thumb tool should allow +1's on words
This commit is contained in:
@@ -999,7 +999,14 @@ namespace HavenSoft.HexManiac.Core.Models.Code {
|
||||
// Parse successful! Nothing else to do.
|
||||
} else {
|
||||
if (line.StartsWith("0x")) line = line.Substring(2);
|
||||
var add = 0;
|
||||
if (line.Contains("+")) {
|
||||
var parts = line.Split("+");
|
||||
if (!int.TryParse(parts[1], out add)) return false;
|
||||
line = parts[0];
|
||||
}
|
||||
if (!int.TryParse(line, NumberStyles.HexNumber, CultureInfo.CurrentCulture, out result)) return false;
|
||||
result += add;
|
||||
}
|
||||
results = new[] {
|
||||
(byte)result,
|
||||
|
||||
@@ -175,5 +175,11 @@ namespace HavenSoft.HexManiac.Tests {
|
||||
ThumbScript = "add r3,r3,#6; add r3, #6";
|
||||
Assert.Equal(Model.ReadMultiByteValue(0, 2), Model.ReadMultiByteValue(2, 2));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Word_PlusOne_Compiles() {
|
||||
ThumbScript = ".word 0x8123456+1";
|
||||
Assert.Equal(0x57, Model[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user