Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions Source/Parser/Expressions/Trigger/MemoryAccessorExpression.cs
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,12 @@ internal override void AppendString(StringBuilder builder)
if (_rememberPointer != null)
{
_rememberPointer.AppendString(builder);

if (Field.Value != 0)
{
builder.Append(" + ");
builder.AppendFormat("0x{0:X2}", Field.Value);
}
}
else if (_pointerChain != null)
{
Expand All @@ -253,7 +259,7 @@ internal override void AppendString(StringBuilder builder)
if (i == 0)
builder.AppendFormat("0x{0:X6}", _pointerChain[i].Left.Value);
else if (_pointerChain[i].Left.Value != 0)
builder.Append(_pointerChain[i].Left.Value);
builder.AppendFormat("0x{0:X2}", _pointerChain[i].Left.Value);
else
builder.Length -= 3;

Expand Down Expand Up @@ -292,7 +298,7 @@ internal override void AppendString(StringBuilder builder)
}

if (Field.Value != 0)
builder.Append(Field.Value);
builder.AppendFormat("0x{0:X2}", Field.Value);
else
builder.Length -= 3;
}
Expand Down
2 changes: 0 additions & 2 deletions Source/Parser/Expressions/Trigger/MemoryValueExpression.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1327,8 +1327,6 @@ private MemoryAccessorExpression ConvertToMemoryAccessor()

public ExpressionBase ClearConstant()
{
Debug.Assert(!IsReadOnly);

if (_memoryAccessors == null)
return new IntegerConstantExpression(0);

Expand Down
6 changes: 4 additions & 2 deletions Source/Parser/Functions/MemoryAccessorFunction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,10 @@ private static MemoryAccessorExpression CreateMemoryAccessorExpression(MemoryVal

if (needRemember)
{
memoryAccessor = new MemoryAccessorExpression(FieldType.MemoryAddress, size, 0U);
memoryAccessor.RememberPointer = new RememberRecallExpression(memoryValue);
memoryAccessor = new MemoryAccessorExpression(FieldType.MemoryAddress, size, (uint) memoryValue.IntegerConstant);
memoryAccessor.RememberPointer = memoryValue.HasConstant ?
new RememberRecallExpression((MemoryValueExpression)memoryValue.ClearConstant()) :
new RememberRecallExpression(memoryValue);
}
else
{
Expand Down
15 changes: 12 additions & 3 deletions Source/Parser/MemoryAccessorAlias.cs
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,15 @@ public string GetAlias(FieldSize size)
return alias;
}

public void SetAlias(FieldSize size, string alias)
{
if (size != PrimarySize && HasReferencedSize(size))
{
_aliases ??= new Dictionary<FieldSize, string>();
_aliases[size] = alias;
}
}

public void UpdateAliasFromNote(NameStyle style)
{
_aliases = null;
Expand Down Expand Up @@ -513,10 +522,10 @@ private static MemoryAccessorAlias GetMemoryAccessor(MemoryAccessorAlias parentM
if (index < 0)
{
CodeNote note = null;
if (parentNote == null)
codeNotes.TryGetValue(field.Value, out note);
else
if (parentNote != null)
note = parentNote.OffsetNotes.FirstOrDefault(n => n.Address == field.Value);
else if (parentMemoryAccessor.Address == 0 && parentMemoryAccessor.PrimarySize == FieldSize.None)
codeNotes.TryGetValue(field.Value, out note);

if (note != null)
memoryAccessor.SetNote(note);
Expand Down
Loading
Loading