Skip to content

Commit

Permalink
Merge branch 'main' into 4.0.0-docs
Browse files Browse the repository at this point in the history
  • Loading branch information
TollyH committed May 29, 2024
2 parents fbc6c9d + acfb808 commit 20e7155
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 3 deletions.
16 changes: 16 additions & 0 deletions AssemblerWarnings.Groups.cs
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,22 @@ public partial class AssemblerWarnings
{
new Opcode(0x03, 0x30), new Opcode(0x03, 0x31), new Opcode(0x03, 0x32),
};
/// <summary>
/// All instructions that always read a single byte from a pointer - regardless of its read size.
/// The pointer is always the first operand.
/// </summary>
internal static readonly HashSet<Opcode> pointerSingleByte = new()
{
new Opcode(0x00, 0xC7),
new Opcode(0x00, 0xCB),
new Opcode(0x00, 0xCF),
new Opcode(0x00, 0xD7),
new Opcode(0x00, 0xDB),
new Opcode(0x00, 0xDF),

new Opcode(0x01, 0x57),
new Opcode(0x01, 0x67),
};

/// <summary>
/// Directives that result in data (non-code bytes) being inserted into the assembly.
Expand Down
3 changes: 2 additions & 1 deletion AssemblerWarnings.Messages.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ public partial class AssemblerWarnings
{ 0032, Strings_AssemblerWarnings.Warning_0032 },
{ 0033, Strings_AssemblerWarnings.Warning_0033 },
{ 0034, Strings_AssemblerWarnings.Warning_0034 },
{ 0035, Strings_AssemblerWarnings.Warning_0035 }
{ 0035, Strings_AssemblerWarnings.Warning_0035 },
{ 0036, Strings_AssemblerWarnings.Warning_0036 },
};

[Localizable(true)]
Expand Down
8 changes: 8 additions & 0 deletions AssemblerWarnings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,7 @@ public AssemblerWarnings(bool usingV1Format)
{ 0033, Analyzer_Rolling_Warning_0033 },
{ 0034, Analyzer_Rolling_Warning_0034 },
{ 0035, Analyzer_Rolling_Warning_0035 },
{ 0036, Analyzer_Rolling_Warning_0036 },
#endif
};
suggestionRollingAnalyzers = new Dictionary<int, RollingWarningAnalyzer>
Expand Down Expand Up @@ -900,6 +901,13 @@ private bool Analyzer_Rolling_Warning_0035()
return newBytes.Length > 0 && !instructionIsData && moveInstructionPointerReadSizes.TryGetValue(instructionOpcode, out PointerReadSize readSize)
&& Assembler.ParsePointer(operands[1]).ReadSize != readSize;
}

private bool Analyzer_Rolling_Warning_0036()
{
// Warning 0036: Pointer size other than 8 bits (`B*`) used in a context where a single byte will always be read.
return newBytes.Length > 0 && !instructionIsData && pointerSingleByte.Contains(instructionOpcode)
&& Assembler.ParsePointer(operands[0]).ReadSize != PointerReadSize.Byte;
}
#endif

private bool Analyzer_Rolling_Suggestion_0001()
Expand Down
2 changes: 1 addition & 1 deletion Example Programs/AoC-2022/D10.asm
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ MVQ rg7, :&PART_TWO_RESULT
:PART_TWO_PRINT_LOOP
CMP rg7, rg4
JGE :END
WCC *rg7
WCC B*rg7
ICR rg7
JMP :PART_TWO_PRINT_LOOP
:END
Expand Down
2 changes: 1 addition & 1 deletion Example Programs/bitmap.ext.asm
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ MVQ rg4, rg3
:FUNC_BITMAP_ENCODE_FILE_WRITE_LOOP
CMP rg4, rg0
JGE :FUNC_BITMAP_ENCODE_FILE_WRITE_LOOP_END
WFC *rg4
WFC B*rg4
ICR rg4
JMP :FUNC_BITMAP_ENCODE_FILE_WRITE_LOOP
:FUNC_BITMAP_ENCODE_FILE_WRITE_LOOP_END
Expand Down
9 changes: 9 additions & 0 deletions Resources/Localization/Strings.AssemblerWarnings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Resources/Localization/Strings.AssemblerWarnings.resx
Original file line number Diff line number Diff line change
Expand Up @@ -240,4 +240,7 @@
<data name="Warning_0035" xml:space="preserve">
<value>Pointer read size does not match the size of this move instruction. The pointer read size will be ignored.</value>
</data>
<data name="Warning_0036" xml:space="preserve">
<value>Pointer size other than 8 bits (`B*`) used in a context where a single byte will always be read.</value>
</data>
</root>

0 comments on commit 20e7155

Please sign in to comment.