movem ISA was wrong regarding movem.w <ea>,<registerlist> (sign extends registers).

Changed Register Flow Documentation wording from 'reads' to 'uses' and from 'modifies' to 'changes'.
Updated screenshot. Added another test case for M68kRegisterFlowDocumentationProviderTest.
This commit is contained in:
Chris Hodges 2021-08-03 10:57:53 +02:00
parent 954f42bf63
commit eb26793a20
7 changed files with 111 additions and 28 deletions

View File

@ -2,7 +2,7 @@
_MC68000 Assembly Language Plugin_ is plugin for Jetbrains IDEs (CLion, IntelliJ, etc.). _MC68000 Assembly Language Plugin_ is plugin for Jetbrains IDEs (CLion, IntelliJ, etc.).
![Example Syntax Highlighting](docs/syntaxhighlighting.png "Example Syntax Highlighting") ![Example IDE Screenshot](docs/example.png "Example IDE Screenshot")
## Purpose ## Purpose
@ -19,13 +19,13 @@ awesome features and is pretty advanced. Check it out. You can install both plug
Big kudos to Yann -- a few features were _inspired_ by his code. Big kudos to Yann -- a few features were _inspired_ by his code.
My plugin, on the other hand, is still pretty basic and is the result of about two weeks of work. I released a really early first version it because I think My plugin, on the other hand, is still pretty basic and is the result of a few weeks of work. I released a really early first version it because I think it's "
it's "good enough" to get started, and I can return to demo coding with its current state. good enough" to get started, and I can return to demo coding with its current state.
## Features ## Features
- Parser / Lexer for MC68000 (yes, only 68000 right now!) assembly language files in VAsm / DevPac style - Parser / Lexer for MC68000 (yes, only 68000 right now!) assembly language files in VAsm / DevPac style
- Inspection for validating the syntax the 68000 ISA. - Inspection for validating the syntax of the 68000 ISA.
- Syntax highlighting and Color Settings Page (you should really modify the color settings to your likings!) - Syntax highlighting and Color Settings Page (you should really modify the color settings to your likings!)
- Mnemonics code completion - Mnemonics code completion
- Symbols / Labels / Macros code completion - Symbols / Labels / Macros code completion
@ -46,7 +46,7 @@ it's "good enough" to get started, and I can return to demo coding with its curr
- While the Lexer supports the -spaces option (where a space introduces a comment), this cannot be configured yet (default is off). - While the Lexer supports the -spaces option (where a space introduces a comment), this cannot be configured yet (default is off).
- No support for other processor instructions, FPU or 68020+ address modes. - No support for other processor instructions, FPU or 68020+ address modes.
- Unit Test coverage is not as good as it could be (ahem). - Unit Test coverage is not as good as it could be (ahem).
- `opt` keyword needs special treatment and will currently show a parsing error - `opt` keyword needs special treatment and will currently show a parsing error.
- Missing but planned features: - Missing but planned features:
- Macro evaluation on invocation - Macro evaluation on invocation
- Folding - Folding
@ -71,6 +71,11 @@ make it work with JUnit 5. Feel free to use the code (in package ```de.platon42.
## Changelog ## Changelog
### V0.5 (unreleased)
- Bugfix: `movem` ISA was wrong regarding the `movem.w <ea>,<registerlist>` (sign extends registers).
- Cosmetics: Changed Register Flow Documentation wording from _reads_ to _uses_ and from _modifies_ to _changes_.
### V0.4 (03-Aug-21) ### V0.4 (03-Aug-21)
- Notice: Due to major new API use, this plugin no longer works on IDEs >=2019.3.1, but rather requires >=2020.3. - Notice: Due to major new API use, this plugin no longer works on IDEs >=2019.3.1, but rather requires >=2020.3.

View File

@ -7,7 +7,7 @@ plugins {
} }
group = 'de.platon42' group = 'de.platon42'
version = '0.4' version = '0.5'
sourceCompatibility = "1.8" sourceCompatibility = "1.8"
targetCompatibility = "1.8" targetCompatibility = "1.8"
@ -57,6 +57,11 @@ runPluginVerifier {
patchPluginXml { patchPluginXml {
setChangeNotes(""" setChangeNotes("""
<h4>V0.5 (unreleased)</h4>
<ul>
<li>Bugfix: movem ISA was wrong regarding movem.w <ea>,<registerlist> (sign extends registers).
<li>Cosmetics: Changed Register Flow Documentation wording from 'reads' to 'uses' and from 'modifies' to 'changes'.
</ul>
<h4>V0.4 (03-Aug-21)</h4> <h4>V0.4 (03-Aug-21)</h4>
<ul> <ul>
<li>Notice: Due to major new API use, this plugin no longer works on IDEs >=2019.3.1, but rather requires >=2020.3. <li>Notice: Due to major new API use, this plugin no longer works on IDEs >=2019.3.1, but rather requires >=2020.3.
@ -82,14 +87,6 @@ patchPluginXml {
<li>Compatibility: Restored compatibility with IDE versions < 2021.1. <li>Compatibility: Restored compatibility with IDE versions < 2021.1.
<li>Performance: Optimized lexer. <li>Performance: Optimized lexer.
</ul> </ul>
<h4>V0.2 (27-Jul-21)</h4>
<ul>
<li>Cosmetics: Added (same) icon for plugin as for file type.
<li>Performance: Use Word-Index for global labels and symbols instead of iterating over the file.
<li>Performance: Use Stub-Index for global labels and symbols.
<li>Bugfix: No longer reports a syntax error when file lacks terminating End-Of-Line.
<li>Enhancement: Registers are now offered for code completion, making editing less annoying.
</ul>
<p>Full changelog available at <a href="https://github.com/chrisly42/mc68000-asm-plugin#changelog">Github project site</a>.</p> <p>Full changelog available at <a href="https://github.com/chrisly42/mc68000-asm-plugin#changelog">Github project site</a>.</p>
""") """)
} }

BIN
docs/example.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 91 KiB

View File

@ -283,7 +283,7 @@ object M68kIsa {
), ),
setOf(AddressMode.REGISTER_LIST, AddressMode.ADDRESS_REGISTER_DIRECT, AddressMode.DATA_REGISTER_DIRECT), setOf(AddressMode.REGISTER_LIST, AddressMode.ADDRESS_REGISTER_DIRECT, AddressMode.DATA_REGISTER_DIRECT),
OP_SIZE_WL, OP_SIZE_WL,
modInfo = RWM_READ_OP1_OPSIZE or RWM_SET_OP2_OPSIZE modInfo = RWM_READ_OP1_OPSIZE or RWM_SET_OP2_L
), ),
// according to Yann, specifying the registers as bitmask is also valid // according to Yann, specifying the registers as bitmask is also valid
AllowedAdrMode( AllowedAdrMode(

View File

@ -189,12 +189,12 @@ class M68kRegisterFlowDocumentationProvider : AbstractDocumentationProvider() {
private fun rwmToDisplayText(rwm: Int, rn: String) = private fun rwmToDisplayText(rwm: Int, rn: String) =
when (rwm) { when (rwm) {
RWM_READ_B -> "reads $rn.b" RWM_READ_B -> "uses $rn.b"
RWM_READ_W -> "reads $rn.w" RWM_READ_W -> "uses $rn.w"
RWM_READ_L -> "reads $rn.l" RWM_READ_L -> "uses $rn.l"
RWM_MODIFY_B -> "modifies $rn.b" RWM_MODIFY_B -> "changes $rn.b"
RWM_MODIFY_W -> "modifies $rn.w" RWM_MODIFY_W -> "changes $rn.w"
RWM_MODIFY_L -> "modifies $rn.l" RWM_MODIFY_L -> "changes $rn.l"
RWM_SET_B -> "sets $rn.b" RWM_SET_B -> "sets $rn.b"
RWM_SET_W -> "sets $rn.w" RWM_SET_W -> "sets $rn.w"
RWM_SET_L -> "sets $rn.l" RWM_SET_L -> "sets $rn.l"

View File

@ -11,7 +11,7 @@ import org.junit.jupiter.api.extension.ExtendWith
internal class M68kRegisterFlowDocumentationProviderTest : AbstractDocumentationProviderTest() { internal class M68kRegisterFlowDocumentationProviderTest : AbstractDocumentationProviderTest() {
@Test @Test
internal fun check_documentation_for_a_register_in_code_flow(@MyFixture myFixture: CodeInsightTestFixture) { internal fun check_documentation_for_a_read_register_in_code_flow(@MyFixture myFixture: CodeInsightTestFixture) {
myFixture.configureByText( myFixture.configureByText(
"documentme.asm", """ "documentme.asm", """
label label
@ -34,7 +34,7 @@ nextlabel
assertThat(generateDocumentation(myFixture)) assertThat(generateDocumentation(myFixture))
.isEqualToIgnoringWhitespace( .isEqualToIgnoringWhitespace(
""" """
<div class="definition">move instruction reads d0.w</div> <div class="definition">move instruction uses d0.w</div>
<table class="sections" style="padding-left: 8pt; padding-right: 8pt"> <table class="sections" style="padding-left: 8pt; padding-right: 8pt">
<tr> <tr>
<td valign="top">        </td> <td valign="top">        </td>
@ -44,7 +44,7 @@ nextlabel
<tr> <tr>
<td valign="top">        </td> <td valign="top">        </td>
<td valign="top"><code>add.w #1,<font color="#ffc800">d0</font></code></td> <td valign="top"><code>add.w #1,<font color="#ffc800">d0</font></code></td>
<td valign="top"> ; modifies d0.w</td> <td valign="top"> ; changes d0.w</td>
</tr> </tr>
<tr> <tr>
<td valign="top">&nbsp;</td> <td valign="top">&nbsp;</td>
@ -56,7 +56,7 @@ nextlabel
<tr> <tr>
<td valign="top">        </td> <td valign="top">        </td>
<td valign="top"><code>move.w <font color="#ffc800">d0</font>,d1</code></td> <td valign="top"><code>move.w <font color="#ffc800">d0</font>,d1</code></td>
<td valign="top"> ; reads d0.w</td> <td valign="top"> ; uses d0.w</td>
</tr> </tr>
<tr> <tr>
<td valign="top">        </td> <td valign="top">        </td>
@ -66,7 +66,7 @@ nextlabel
<tr> <tr>
<td valign="top">        </td> <td valign="top">        </td>
<td valign="top"><code>addq.b #1,<font color="#ffc800">d0</font></code></td> <td valign="top"><code>addq.b #1,<font color="#ffc800">d0</font></code></td>
<td valign="top"> ; modifies d0.b</td> <td valign="top"> ; changes d0.b</td>
</tr> </tr>
<tr> <tr>
<td valign="top">--&gt;</td> <td valign="top">--&gt;</td>
@ -76,7 +76,7 @@ nextlabel
<tr> <tr>
<td valign="top">        </td> <td valign="top">        </td>
<td valign="top"><code>move.l <font color="#ffc800">d0</font>,d2</code></td> <td valign="top"><code>move.l <font color="#ffc800">d0</font>,d2</code></td>
<td valign="top"> ; reads d0.l</td> <td valign="top"> ; uses d0.l</td>
</tr> </tr>
<tr> <tr>
<td valign="top">&nbsp;</td> <td valign="top">&nbsp;</td>
@ -96,7 +96,88 @@ nextlabel
<td valign="top"> ; <font color="#00ff00">sets d0.l</font></td> <td valign="top"> ; <font color="#00ff00">sets d0.l</font></td>
</tr> </tr>
</table> </table>
""".trimIndent() """
)
}
@Test
internal fun check_documentation_for_a_written_register_in_code_flow(@MyFixture myFixture: CodeInsightTestFixture) {
myFixture.configureByText(
"documentme.asm", """
label
moveq.l #0,d0
add.w #1,d0
move.l d1,-(sp)
move.w d0,d1
move.b d2,d0
addq.b #1,d0
move.w d0,d<caret>1
move.l d0,d2
move.w d1,d2
clr.b d0
moveq.l #0,d0
move.l (sp)+,d1
rts
nextlabel
"""
)
assertThat(generateDocumentation(myFixture))
.isEqualToIgnoringWhitespace(
"""
<div class="definition">move instruction sets d1.w</div>
<table class="sections" style="padding-left: 8pt; padding-right: 8pt">
<tr>
<td colspan="3" valign="top"><b>label</b></td>
</tr>
<tr>
<td valign="top">        </td>
<td valign="top"><code>move.l <font color="#ffc800">d1</font>,-(sp)</code></td>
<td valign="top"> ; uses d1.l</td>
</tr>
<tr>
<td valign="top">        </td>
<td valign="top"><code>move.w d0,<font color="#ffc800">d1</font></code></td>
<td valign="top"> ; sets d1.w</td>
</tr>
<tr>
<td valign="top">&nbsp;</td>
<td valign="top">
<div class="grayed">[...]</div>
</td>
<td valign="top">&nbsp;</td>
</tr>
<tr>
<td valign="top">--&gt;</td>
<td valign="top"><b><code>move.w d0,<font color="#ffc800">d1</font></code></b></td>
<td valign="top"> ; &lt;--</td>
</tr>
<tr>
<td valign="top">&nbsp;</td>
<td valign="top">
<div class="grayed">[...]</div>
</td>
<td valign="top">&nbsp;</td>
</tr>
<tr>
<td valign="top">        </td>
<td valign="top"><code>move.w <font color="#ffc800">d1</font>,d2</code></td>
<td valign="top"> ; uses d1.w</td>
</tr>
<tr>
<td valign="top">&nbsp;</td>
<td valign="top">
<div class="grayed">[...]</div>
</td>
<td valign="top">&nbsp;</td>
</tr>
<tr>
<td valign="top">        </td>
<td valign="top"><code>move.l (sp)+,<font color="#ffc800">d1</font></code></td>
<td valign="top"> ; <font color="#00ff00">sets d1.l</font></td>
</tr>
</table>
"""
) )
} }
} }