diff --git a/README.md b/README.md
index 5b0fd9b..aec1116 100644
--- a/README.md
+++ b/README.md
@@ -10,8 +10,8 @@ This plugin delivers support for MC68000 assembly language files ([VAsm](http://
It adds a language parser with syntax highlighting, referencing and refactoring support, and a few more features.
-I'm an Amiga retro democoder, and the lack of a plugin for M68k was the motivation to write one. Also, diving deep into custom language plugins has a steep
-learning curve.
+I'm an Amiga retro democoder (among other things), and the lack of a plugin for M68k was the motivation to write one. Also, diving deep into custom language
+plugins has a steep learning curve.
When I started the plugin in July 2021, I was not aware of the [M68k plugin efforts by Jetbrains employee Yann Cébron](https://github.com/YannCebron/m68kplugin)
who has been working on the same topic for quite some time. At the time of writing, his plugin however, has not been release yet. Nevertheless, it has a lot of
@@ -154,6 +154,7 @@ are appreciated. They really are, because they do keep me motivated to continue
- Bugfix: `movem` with pc-relative mode was missing for weird immediate mode (courtesy of Yann).
- Bugfix: Special registers for address mode matching only worked with lower case register names (courtesy of Yann).
- Enhancement: Assembler syntax with implicit immediate 1 for shifts and rotations no longer cause syntax errors (courtesy of Yann).
+- Enhancement: Documentation for instruction with special register shows specific register expected.
### V0.6 (09-Aug-21)
diff --git a/build.gradle b/build.gradle
index e3d06c4..79be03f 100644
--- a/build.gradle
+++ b/build.gradle
@@ -63,6 +63,7 @@ patchPluginXml {
Bugfix: 'movem' with pc-relative mode was missing for weird immediate mode (courtesy of Yann).
Bugfix: Special registers for address mode matching only worked with lower case register names (courtesy of Yann).
Enhancement: Assembler syntax with implicit immediate 1 for shifts and rotations no longer cause syntax errors (courtesy of Yann).
+ Enhancement: Documentation for instruction with special register shows specific register expected.
V0.6 (09-Aug-21)
diff --git a/src/main/java/de/platon42/intellij/plugins/m68k/documentation/M68kInstructionDocumentationProvider.kt b/src/main/java/de/platon42/intellij/plugins/m68k/documentation/M68kInstructionDocumentationProvider.kt
index dbeb0dc..0f677ba 100644
--- a/src/main/java/de/platon42/intellij/plugins/m68k/documentation/M68kInstructionDocumentationProvider.kt
+++ b/src/main/java/de/platon42/intellij/plugins/m68k/documentation/M68kInstructionDocumentationProvider.kt
@@ -92,8 +92,8 @@ class M68kInstructionDocumentationProvider : AbstractDocumentationProvider() {
val cellsPerRow = ArrayList(3)
cellsPerRow.add(contentBuilder.toFragment())
- if (allowedAdrMode.op1 != null) cellsPerRow.add(collectAddressModes(allowedAdrMode.op1))
- if (allowedAdrMode.op1 != null) cellsPerRow.add(collectAddressModes(allowedAdrMode.op2))
+ if (allowedAdrMode.op1 != null) cellsPerRow.add(collectAddressModes(allowedAdrMode.op1, allowedAdrMode.specialReg))
+ if (allowedAdrMode.op1 != null) cellsPerRow.add(collectAddressModes(allowedAdrMode.op2, allowedAdrMode.specialReg))
addressModeInfoRows.append(HtmlChunk.tag("tr").children(cellsPerRow.map { it.wrapWith(DocumentationMarkup.SECTION_CONTENT_CELL) }))
addressModeInfoRows.toFragment()
@@ -126,11 +126,12 @@ class M68kInstructionDocumentationProvider : AbstractDocumentationProvider() {
return defBuilder
}
- private fun collectAddressModes(addressModes: Set?): HtmlChunk {
+ private fun collectAddressModes(addressModes: Set?, specialReg: String?): HtmlChunk {
if (addressModes == null) return HtmlChunk.text("")
val modes = HtmlBuilder()
addressModes.sortedBy(AddressMode::ordinal)
- .forEach { modes.append(HtmlChunk.text(it.syntax).wrapWith(HtmlChunk.div())) }
+ .map { if (it == AddressMode.SPECIAL_REGISTER_DIRECT) specialReg!! else it.syntax }
+ .forEach { modes.append(HtmlChunk.text(it).wrapWith(HtmlChunk.div())) }
return modes.toFragment()
}
diff --git a/src/test/java/de/platon42/intellij/plugins/m68k/documentation/M68kInstructionDocumentationProviderTest.kt b/src/test/java/de/platon42/intellij/plugins/m68k/documentation/M68kInstructionDocumentationProviderTest.kt
index 916fb8f..831d83e 100644
--- a/src/test/java/de/platon42/intellij/plugins/m68k/documentation/M68kInstructionDocumentationProviderTest.kt
+++ b/src/test/java/de/platon42/intellij/plugins/m68k/documentation/M68kInstructionDocumentationProviderTest.kt
@@ -108,6 +108,16 @@ internal class M68kInstructionDocumentationProviderTest : AbstractDocumentationP
assertThat(generateDocumentation(myFixture)).contains("Reset External Devices", "(privileged)")
}
+ @Test
+ internal fun check_documentation_for_instruction_with_special_register(@MyFixture myFixture: CodeInsightTestFixture) {
+ myFixture.configureByText(
+ "documentme.asm", """
+ move.l usp,a0
+ """
+ )
+ assertThat(generateDocumentation(myFixture)).contains("usp
")
+ }
+
@Test
internal fun check_documentation_if_there_is_no_concrete_match(@MyFixture myFixture: CodeInsightTestFixture) {
myFixture.configureByText(