Skip to content

Commit

Permalink
Fix warning 0005 when not compiling with displacements
Browse files Browse the repository at this point in the history
  • Loading branch information
TollyH committed May 20, 2024
1 parent a7bfcc4 commit cd5f3d4
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions AssemblerWarnings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -582,6 +582,7 @@ private List<Warning> Analyzer_Final_Warning_0005()
List<Warning> warnings = new();
foreach ((FilePosition writePosition, string? writeMacroName, int writeMacroLineDepth, string writeOperand) in readsFromAddress)
{
#if DISPLACEMENT
AddressReference reference = Assembler.ParseAddressReference(writeOperand);
ulong address = reference.ReferenceType switch
{
Expand All @@ -593,6 +594,17 @@ private List<Warning> Analyzer_Final_Warning_0005()
{
address += (ulong)reference.DisplacementConstant;
}
#else
ulong address;
if (writeOperand[1] is >= '0' and <= '9')
{
Assembler.ParseLiteral(writeOperand[1..], false, out address);
}
else
{
address = referencedLabels[writeOperand[1..]];
}
#endif
if (executableAddresses.Contains(address) && address < currentAddress)
{
warnings.Add(new Warning(WarningSeverity.Warning, 0005, writePosition,
Expand Down

0 comments on commit cd5f3d4

Please sign in to comment.