diff --git a/README.md b/README.md
index 0697c30..03b7d42 100644
--- a/README.md
+++ b/README.md
@@ -6,7 +6,7 @@ _MC68000 Assembly Language Plugin_ is plugin for Jetbrains IDEs (CLion, IntelliJ
## Purpose
-This plugin delivers support for MC68000 assembly language files ([VAsm](http://sun.hasenbraten.de/vasm/) / DevPac-Style).
+This plugin delivers support for MC680xx assembly language files ([VAsm](http://sun.hasenbraten.de/vasm/) / DevPac-Style).
It adds a language parser with syntax highlighting, referencing and refactoring support, and a few more features.
@@ -25,8 +25,8 @@ to get started, and I can return to demo coding with its current state.
## Features
-- Parser / Lexer for MC68000 (yes, only 68000 right now!) assembly language files in VAsm / DevPac style
-- Validates the assembly syntax against the 68000 ISA.
+- Parser / Lexer for MC680xx assembly language files in VAsm / DevPac style
+- Validates the assembly syntax against the 68000 ISA and 68020+ addressing modes (no complete >68020 support yet!)
- Syntax highlighting and Color Settings Page (you should really modify the color settings to your likings!)
- Mnemonics code completion
- Symbols / labels / macros code completion
@@ -163,6 +163,7 @@ are appreciated. It really is keeping me motivated to continue development.
### V0.8 (unreleased)
+- New: Support for MC68020+ addressing modes! However, MC68020+ specific instructions have not been added yet.
- Enhancement: Label documentation now also works for local labels and includes end-of-line comment for label, too.
- Enhancement: Symbol definition documentation now also includes comments in the same way as the label documentation does.
- New: Macro definition / invocation documentation provider that even tries to expand macros.
diff --git a/build.gradle b/build.gradle
index 2f8f26b..81a893c 100644
--- a/build.gradle
+++ b/build.gradle
@@ -60,6 +60,7 @@ patchPluginXml {
I still got zero feedback and zero ratings :-(
V0.8 (unreleased)
+ - New: Support for MC68020+ addressing modes! However, MC68020+ specific instructions have not been added yet.
- Enhancement: Label documentation now also works for local labels and includes end-of-line comment for label, too.
- Enhancement: Symbol definition documentation now also includes comments in the same way as the label documentation does.
- New: Macro definition / invocation documentation provider that even tries to expand macros.
diff --git a/src/main/gen/de/platon42/intellij/plugins/m68k/parser/M68kParser.java b/src/main/gen/de/platon42/intellij/plugins/m68k/parser/M68kParser.java
index 6f5b88a..da1a2fb 100644
--- a/src/main/gen/de/platon42/intellij/plugins/m68k/parser/M68kParser.java
+++ b/src/main/gen/de/platon42/intellij/plugins/m68k/parser/M68kParser.java
@@ -916,7 +916,7 @@ public class M68kParser implements PsiParser, LightPsiParser {
}
/* ********************************************************** */
- // ROUND_L (SQUARE_L (BaseDisplacement SEPARATOR)? AddressRegister SQUARE_R SEPARATOR)? IndexRegister (SEPARATOR OuterDisplacement)? ROUND_R
+ // ROUND_L (SQUARE_L (internalMemoryIndirectPostIndexedOption1|internalMemoryIndirectPostIndexedOption2) SQUARE_R SEPARATOR)? IndexRegister (SEPARATOR OuterDisplacement)? ROUND_R
public static boolean MemoryIndirectPostIndexedAddressingMode(PsiBuilder b, int l) {
if (!recursion_guard_(b, l, "MemoryIndirectPostIndexedAddressingMode")) return false;
if (!nextTokenIsFast(b, ROUND_L)) return false;
@@ -931,41 +931,31 @@ public class M68kParser implements PsiParser, LightPsiParser {
return r;
}
- // (SQUARE_L (BaseDisplacement SEPARATOR)? AddressRegister SQUARE_R SEPARATOR)?
+ // (SQUARE_L (internalMemoryIndirectPostIndexedOption1|internalMemoryIndirectPostIndexedOption2) SQUARE_R SEPARATOR)?
private static boolean MemoryIndirectPostIndexedAddressingMode_1(PsiBuilder b, int l) {
if (!recursion_guard_(b, l, "MemoryIndirectPostIndexedAddressingMode_1")) return false;
MemoryIndirectPostIndexedAddressingMode_1_0(b, l + 1);
return true;
}
- // SQUARE_L (BaseDisplacement SEPARATOR)? AddressRegister SQUARE_R SEPARATOR
+ // SQUARE_L (internalMemoryIndirectPostIndexedOption1|internalMemoryIndirectPostIndexedOption2) SQUARE_R SEPARATOR
private static boolean MemoryIndirectPostIndexedAddressingMode_1_0(PsiBuilder b, int l) {
if (!recursion_guard_(b, l, "MemoryIndirectPostIndexedAddressingMode_1_0")) return false;
boolean r;
Marker m = enter_section_(b);
r = consumeTokenFast(b, SQUARE_L);
r = r && MemoryIndirectPostIndexedAddressingMode_1_0_1(b, l + 1);
- r = r && AddressRegister(b, l + 1);
r = r && consumeTokens(b, 0, SQUARE_R, SEPARATOR);
exit_section_(b, m, null, r);
return r;
}
- // (BaseDisplacement SEPARATOR)?
+ // internalMemoryIndirectPostIndexedOption1|internalMemoryIndirectPostIndexedOption2
private static boolean MemoryIndirectPostIndexedAddressingMode_1_0_1(PsiBuilder b, int l) {
if (!recursion_guard_(b, l, "MemoryIndirectPostIndexedAddressingMode_1_0_1")) return false;
- MemoryIndirectPostIndexedAddressingMode_1_0_1_0(b, l + 1);
- return true;
- }
-
- // BaseDisplacement SEPARATOR
- private static boolean MemoryIndirectPostIndexedAddressingMode_1_0_1_0(PsiBuilder b, int l) {
- if (!recursion_guard_(b, l, "MemoryIndirectPostIndexedAddressingMode_1_0_1_0")) return false;
boolean r;
- Marker m = enter_section_(b);
- r = BaseDisplacement(b, l + 1);
- r = r && consumeToken(b, SEPARATOR);
- exit_section_(b, m, null, r);
+ r = internalMemoryIndirectPostIndexedOption1(b, l + 1);
+ if (!r) r = internalMemoryIndirectPostIndexedOption2(b, l + 1);
return r;
}
@@ -988,7 +978,7 @@ public class M68kParser implements PsiParser, LightPsiParser {
}
/* ********************************************************** */
- // ROUND_L SQUARE_L (BaseDisplacement SEPARATOR)? AddressRegister SEPARATOR IndexRegister SQUARE_R (SEPARATOR OuterDisplacement)? ROUND_R
+ // ROUND_L SQUARE_L (BaseDisplacement SEPARATOR)? (AddressRegister SEPARATOR)? IndexRegister SQUARE_R (SEPARATOR OuterDisplacement)? ROUND_R
public static boolean MemoryIndirectPreIndexedAddressingMode(PsiBuilder b, int l) {
if (!recursion_guard_(b, l, "MemoryIndirectPreIndexedAddressingMode")) return false;
if (!nextTokenIsFast(b, ROUND_L)) return false;
@@ -996,11 +986,10 @@ public class M68kParser implements PsiParser, LightPsiParser {
Marker m = enter_section_(b, l, _NONE_, MEMORY_INDIRECT_PRE_INDEXED_ADDRESSING_MODE, "");
r = consumeTokens(b, 0, ROUND_L, SQUARE_L);
r = r && MemoryIndirectPreIndexedAddressingMode_2(b, l + 1);
- r = r && AddressRegister(b, l + 1);
- r = r && consumeToken(b, SEPARATOR);
+ r = r && MemoryIndirectPreIndexedAddressingMode_3(b, l + 1);
r = r && IndexRegister(b, l + 1);
r = r && consumeToken(b, SQUARE_R);
- r = r && MemoryIndirectPreIndexedAddressingMode_7(b, l + 1);
+ r = r && MemoryIndirectPreIndexedAddressingMode_6(b, l + 1);
r = r && consumeToken(b, ROUND_R);
exit_section_(b, l, m, r, false, null);
return r;
@@ -1024,16 +1013,34 @@ public class M68kParser implements PsiParser, LightPsiParser {
return r;
}
+ // (AddressRegister SEPARATOR)?
+ private static boolean MemoryIndirectPreIndexedAddressingMode_3(PsiBuilder b, int l) {
+ if (!recursion_guard_(b, l, "MemoryIndirectPreIndexedAddressingMode_3")) return false;
+ MemoryIndirectPreIndexedAddressingMode_3_0(b, l + 1);
+ return true;
+ }
+
+ // AddressRegister SEPARATOR
+ private static boolean MemoryIndirectPreIndexedAddressingMode_3_0(PsiBuilder b, int l) {
+ if (!recursion_guard_(b, l, "MemoryIndirectPreIndexedAddressingMode_3_0")) return false;
+ boolean r;
+ Marker m = enter_section_(b);
+ r = AddressRegister(b, l + 1);
+ r = r && consumeToken(b, SEPARATOR);
+ exit_section_(b, m, null, r);
+ return r;
+ }
+
// (SEPARATOR OuterDisplacement)?
- private static boolean MemoryIndirectPreIndexedAddressingMode_7(PsiBuilder b, int l) {
- if (!recursion_guard_(b, l, "MemoryIndirectPreIndexedAddressingMode_7")) return false;
- MemoryIndirectPreIndexedAddressingMode_7_0(b, l + 1);
+ private static boolean MemoryIndirectPreIndexedAddressingMode_6(PsiBuilder b, int l) {
+ if (!recursion_guard_(b, l, "MemoryIndirectPreIndexedAddressingMode_6")) return false;
+ MemoryIndirectPreIndexedAddressingMode_6_0(b, l + 1);
return true;
}
// SEPARATOR OuterDisplacement
- private static boolean MemoryIndirectPreIndexedAddressingMode_7_0(PsiBuilder b, int l) {
- if (!recursion_guard_(b, l, "MemoryIndirectPreIndexedAddressingMode_7_0")) return false;
+ private static boolean MemoryIndirectPreIndexedAddressingMode_6_0(PsiBuilder b, int l) {
+ if (!recursion_guard_(b, l, "MemoryIndirectPreIndexedAddressingMode_6_0")) return false;
boolean r;
Marker m = enter_section_(b);
r = consumeTokenFast(b, SEPARATOR);
@@ -1852,6 +1859,66 @@ public class M68kParser implements PsiParser, LightPsiParser {
return r;
}
+ /* ********************************************************** */
+ // (BaseDisplacement SEPARATOR)? AddressRegister
+ static boolean internalMemoryIndirectPostIndexedOption1(PsiBuilder b, int l) {
+ if (!recursion_guard_(b, l, "internalMemoryIndirectPostIndexedOption1")) return false;
+ boolean r;
+ Marker m = enter_section_(b);
+ r = internalMemoryIndirectPostIndexedOption1_0(b, l + 1);
+ r = r && AddressRegister(b, l + 1);
+ exit_section_(b, m, null, r);
+ return r;
+ }
+
+ // (BaseDisplacement SEPARATOR)?
+ private static boolean internalMemoryIndirectPostIndexedOption1_0(PsiBuilder b, int l) {
+ if (!recursion_guard_(b, l, "internalMemoryIndirectPostIndexedOption1_0")) return false;
+ internalMemoryIndirectPostIndexedOption1_0_0(b, l + 1);
+ return true;
+ }
+
+ // BaseDisplacement SEPARATOR
+ private static boolean internalMemoryIndirectPostIndexedOption1_0_0(PsiBuilder b, int l) {
+ if (!recursion_guard_(b, l, "internalMemoryIndirectPostIndexedOption1_0_0")) return false;
+ boolean r;
+ Marker m = enter_section_(b);
+ r = BaseDisplacement(b, l + 1);
+ r = r && consumeToken(b, SEPARATOR);
+ exit_section_(b, m, null, r);
+ return r;
+ }
+
+ /* ********************************************************** */
+ // BaseDisplacement (SEPARATOR AddressRegister)?
+ static boolean internalMemoryIndirectPostIndexedOption2(PsiBuilder b, int l) {
+ if (!recursion_guard_(b, l, "internalMemoryIndirectPostIndexedOption2")) return false;
+ boolean r;
+ Marker m = enter_section_(b);
+ r = BaseDisplacement(b, l + 1);
+ r = r && internalMemoryIndirectPostIndexedOption2_1(b, l + 1);
+ exit_section_(b, m, null, r);
+ return r;
+ }
+
+ // (SEPARATOR AddressRegister)?
+ private static boolean internalMemoryIndirectPostIndexedOption2_1(PsiBuilder b, int l) {
+ if (!recursion_guard_(b, l, "internalMemoryIndirectPostIndexedOption2_1")) return false;
+ internalMemoryIndirectPostIndexedOption2_1_0(b, l + 1);
+ return true;
+ }
+
+ // SEPARATOR AddressRegister
+ private static boolean internalMemoryIndirectPostIndexedOption2_1_0(PsiBuilder b, int l) {
+ if (!recursion_guard_(b, l, "internalMemoryIndirectPostIndexedOption2_1_0")) return false;
+ boolean r;
+ Marker m = enter_section_(b);
+ r = consumeToken(b, SEPARATOR);
+ r = r && AddressRegister(b, l + 1);
+ exit_section_(b, m, null, r);
+ return r;
+ }
+
/* ********************************************************** */
// !<> (MacroDefinition | statement) (<>|EOL)
static boolean line(PsiBuilder b, int l) {
diff --git a/src/main/gen/de/platon42/intellij/plugins/m68k/psi/M68kAddressRegisterIndirectWithIndexBaseDisplacementAddressingMode.java b/src/main/gen/de/platon42/intellij/plugins/m68k/psi/M68kAddressRegisterIndirectWithIndexBaseDisplacementAddressingMode.java
new file mode 100644
index 0000000..558b3dc
--- /dev/null
+++ b/src/main/gen/de/platon42/intellij/plugins/m68k/psi/M68kAddressRegisterIndirectWithIndexBaseDisplacementAddressingMode.java
@@ -0,0 +1,17 @@
+// This is a generated file. Not intended for manual editing.
+package de.platon42.intellij.plugins.m68k.psi;
+
+import org.jetbrains.annotations.Nullable;
+
+public interface M68kAddressRegisterIndirectWithIndexBaseDisplacementAddressingMode extends M68kAddressingMode, M68kWithOptionalAddressRegisterIndirect, M68kWithBaseDisplacement, M68kWithOptionalIndexRegister {
+
+ @Nullable
+ M68kAddressRegister getAddressRegister();
+
+ @Nullable
+ M68kIndexRegister getIndexRegister();
+
+ @Nullable
+ M68kBaseDisplacement getBaseDisplacement();
+
+}
diff --git a/src/main/gen/de/platon42/intellij/plugins/m68k/psi/M68kMemoryIndirectPostIndexedAddressingMode.java b/src/main/gen/de/platon42/intellij/plugins/m68k/psi/M68kMemoryIndirectPostIndexedAddressingMode.java
index 65f4619..b531062 100644
--- a/src/main/gen/de/platon42/intellij/plugins/m68k/psi/M68kMemoryIndirectPostIndexedAddressingMode.java
+++ b/src/main/gen/de/platon42/intellij/plugins/m68k/psi/M68kMemoryIndirectPostIndexedAddressingMode.java
@@ -4,7 +4,7 @@ package de.platon42.intellij.plugins.m68k.psi;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
-public interface M68kMemoryIndirectPostIndexedAddressingMode extends M68kAddressingMode, M68kWithAddressRegisterIndirect, M68kWithBaseDisplacement, M68kWithIndexRegister, M68kWithOuterDisplacement {
+public interface M68kMemoryIndirectPostIndexedAddressingMode extends M68kAddressingMode, M68kWithOptionalAddressRegisterIndirect, M68kWithBaseDisplacement, M68kWithIndexRegister, M68kWithOuterDisplacement {
@Nullable
M68kAddressRegister getAddressRegister();
diff --git a/src/main/gen/de/platon42/intellij/plugins/m68k/psi/M68kMemoryIndirectPreIndexedAddressingMode.java b/src/main/gen/de/platon42/intellij/plugins/m68k/psi/M68kMemoryIndirectPreIndexedAddressingMode.java
index 97d4aeb..d221e44 100644
--- a/src/main/gen/de/platon42/intellij/plugins/m68k/psi/M68kMemoryIndirectPreIndexedAddressingMode.java
+++ b/src/main/gen/de/platon42/intellij/plugins/m68k/psi/M68kMemoryIndirectPreIndexedAddressingMode.java
@@ -4,9 +4,9 @@ package de.platon42.intellij.plugins.m68k.psi;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
-public interface M68kMemoryIndirectPreIndexedAddressingMode extends M68kAddressingMode, M68kWithAddressRegisterIndirect, M68kWithBaseDisplacement, M68kWithIndexRegister, M68kWithOuterDisplacement {
+public interface M68kMemoryIndirectPreIndexedAddressingMode extends M68kAddressingMode, M68kWithOptionalAddressRegisterIndirect, M68kWithBaseDisplacement, M68kWithIndexRegister, M68kWithOuterDisplacement {
- @NotNull
+ @Nullable
M68kAddressRegister getAddressRegister();
@NotNull
diff --git a/src/main/gen/de/platon42/intellij/plugins/m68k/psi/M68kProgramCounterIndirectWithIndexBaseDisplacementAddressingMode.java b/src/main/gen/de/platon42/intellij/plugins/m68k/psi/M68kProgramCounterIndirectWithIndexBaseDisplacementAddressingMode.java
new file mode 100644
index 0000000..aa3ffe8
--- /dev/null
+++ b/src/main/gen/de/platon42/intellij/plugins/m68k/psi/M68kProgramCounterIndirectWithIndexBaseDisplacementAddressingMode.java
@@ -0,0 +1,14 @@
+// This is a generated file. Not intended for manual editing.
+package de.platon42.intellij.plugins.m68k.psi;
+
+import org.jetbrains.annotations.Nullable;
+
+public interface M68kProgramCounterIndirectWithIndexBaseDisplacementAddressingMode extends M68kAddressingMode, M68kWithBaseDisplacement, M68kWithOptionalIndexRegister {
+
+ @Nullable
+ M68kIndexRegister getIndexRegister();
+
+ @Nullable
+ M68kBaseDisplacement getBaseDisplacement();
+
+}
diff --git a/src/main/gen/de/platon42/intellij/plugins/m68k/psi/M68kVisitor.java b/src/main/gen/de/platon42/intellij/plugins/m68k/psi/M68kVisitor.java
index 701ad43..9f67bd8 100644
--- a/src/main/gen/de/platon42/intellij/plugins/m68k/psi/M68kVisitor.java
+++ b/src/main/gen/de/platon42/intellij/plugins/m68k/psi/M68kVisitor.java
@@ -49,7 +49,7 @@ public class M68kVisitor extends PsiElementVisitor {
visitAddressingMode(o);
// visitWithOptionalAddressRegisterIndirect(o);
// visitWithBaseDisplacement(o);
- // visitWithIndexRegister(o);
+ // visitWithOptionalIndexRegister(o);
}
public void visitAddressRegisterIndirectWithIndexNewAddressingMode(@NotNull M68kAddressRegisterIndirectWithIndexNewAddressingMode o) {
@@ -147,7 +147,7 @@ public class M68kVisitor extends PsiElementVisitor {
public void visitMemoryIndirectPostIndexedAddressingMode(@NotNull M68kMemoryIndirectPostIndexedAddressingMode o) {
visitAddressingMode(o);
- // visitWithAddressRegisterIndirect(o);
+ // visitWithOptionalAddressRegisterIndirect(o);
// visitWithBaseDisplacement(o);
// visitWithIndexRegister(o);
// visitWithOuterDisplacement(o);
@@ -155,7 +155,7 @@ public class M68kVisitor extends PsiElementVisitor {
public void visitMemoryIndirectPreIndexedAddressingMode(@NotNull M68kMemoryIndirectPreIndexedAddressingMode o) {
visitAddressingMode(o);
- // visitWithAddressRegisterIndirect(o);
+ // visitWithOptionalAddressRegisterIndirect(o);
// visitWithBaseDisplacement(o);
// visitWithIndexRegister(o);
// visitWithOuterDisplacement(o);
@@ -190,7 +190,7 @@ public class M68kVisitor extends PsiElementVisitor {
public void visitProgramCounterIndirectWithIndexBaseDisplacementAddressingMode(@NotNull M68kProgramCounterIndirectWithIndexBaseDisplacementAddressingMode o) {
visitAddressingMode(o);
// visitWithBaseDisplacement(o);
- // visitWithIndexRegister(o);
+ // visitWithOptionalIndexRegister(o);
}
public void visitProgramCounterIndirectWithIndexNewAddressingMode(@NotNull M68kProgramCounterIndirectWithIndexNewAddressingMode o) {
diff --git a/src/main/gen/de/platon42/intellij/plugins/m68k/psi/impl/M68kAddressRegisterIndirectWithIndexBaseDisplacementAddressingModeImpl.java b/src/main/gen/de/platon42/intellij/plugins/m68k/psi/impl/M68kAddressRegisterIndirectWithIndexBaseDisplacementAddressingModeImpl.java
new file mode 100644
index 0000000..54f7824
--- /dev/null
+++ b/src/main/gen/de/platon42/intellij/plugins/m68k/psi/impl/M68kAddressRegisterIndirectWithIndexBaseDisplacementAddressingModeImpl.java
@@ -0,0 +1,46 @@
+// This is a generated file. Not intended for manual editing.
+package de.platon42.intellij.plugins.m68k.psi.impl;
+
+import com.intellij.lang.ASTNode;
+import com.intellij.psi.PsiElementVisitor;
+import com.intellij.psi.util.PsiTreeUtil;
+import de.platon42.intellij.plugins.m68k.psi.*;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+public class M68kAddressRegisterIndirectWithIndexBaseDisplacementAddressingModeImpl extends M68kAddressingModeImpl implements M68kAddressRegisterIndirectWithIndexBaseDisplacementAddressingMode {
+
+ public M68kAddressRegisterIndirectWithIndexBaseDisplacementAddressingModeImpl(@NotNull ASTNode node) {
+ super(node);
+ }
+
+ @Override
+ public void accept(@NotNull M68kVisitor visitor) {
+ visitor.visitAddressRegisterIndirectWithIndexBaseDisplacementAddressingMode(this);
+ }
+
+ @Override
+ public void accept(@NotNull PsiElementVisitor visitor) {
+ if (visitor instanceof M68kVisitor) accept((M68kVisitor) visitor);
+ else super.accept(visitor);
+ }
+
+ @Override
+ @Nullable
+ public M68kAddressRegister getAddressRegister() {
+ return PsiTreeUtil.getChildOfType(this, M68kAddressRegister.class);
+ }
+
+ @Override
+ @Nullable
+ public M68kIndexRegister getIndexRegister() {
+ return PsiTreeUtil.getChildOfType(this, M68kIndexRegister.class);
+ }
+
+ @Override
+ @Nullable
+ public M68kBaseDisplacement getBaseDisplacement() {
+ return PsiTreeUtil.getChildOfType(this, M68kBaseDisplacement.class);
+ }
+
+}
diff --git a/src/main/gen/de/platon42/intellij/plugins/m68k/psi/impl/M68kMemoryIndirectPreIndexedAddressingModeImpl.java b/src/main/gen/de/platon42/intellij/plugins/m68k/psi/impl/M68kMemoryIndirectPreIndexedAddressingModeImpl.java
index 7e33aaf..e254fbf 100644
--- a/src/main/gen/de/platon42/intellij/plugins/m68k/psi/impl/M68kMemoryIndirectPreIndexedAddressingModeImpl.java
+++ b/src/main/gen/de/platon42/intellij/plugins/m68k/psi/impl/M68kMemoryIndirectPreIndexedAddressingModeImpl.java
@@ -26,9 +26,9 @@ public class M68kMemoryIndirectPreIndexedAddressingModeImpl extends M68kAddressi
}
@Override
- @NotNull
+ @Nullable
public M68kAddressRegister getAddressRegister() {
- return notNullChild(PsiTreeUtil.getChildOfType(this, M68kAddressRegister.class));
+ return PsiTreeUtil.getChildOfType(this, M68kAddressRegister.class);
}
@Override
diff --git a/src/main/gen/de/platon42/intellij/plugins/m68k/psi/impl/M68kProgramCounterIndirectWithIndexBaseDisplacementAddressingModeImpl.java b/src/main/gen/de/platon42/intellij/plugins/m68k/psi/impl/M68kProgramCounterIndirectWithIndexBaseDisplacementAddressingModeImpl.java
new file mode 100644
index 0000000..53e10f0
--- /dev/null
+++ b/src/main/gen/de/platon42/intellij/plugins/m68k/psi/impl/M68kProgramCounterIndirectWithIndexBaseDisplacementAddressingModeImpl.java
@@ -0,0 +1,43 @@
+// This is a generated file. Not intended for manual editing.
+package de.platon42.intellij.plugins.m68k.psi.impl;
+
+import com.intellij.lang.ASTNode;
+import com.intellij.psi.PsiElementVisitor;
+import com.intellij.psi.util.PsiTreeUtil;
+import de.platon42.intellij.plugins.m68k.psi.M68kBaseDisplacement;
+import de.platon42.intellij.plugins.m68k.psi.M68kIndexRegister;
+import de.platon42.intellij.plugins.m68k.psi.M68kProgramCounterIndirectWithIndexBaseDisplacementAddressingMode;
+import de.platon42.intellij.plugins.m68k.psi.M68kVisitor;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+public class M68kProgramCounterIndirectWithIndexBaseDisplacementAddressingModeImpl extends M68kAddressingModeImpl implements M68kProgramCounterIndirectWithIndexBaseDisplacementAddressingMode {
+
+ public M68kProgramCounterIndirectWithIndexBaseDisplacementAddressingModeImpl(@NotNull ASTNode node) {
+ super(node);
+ }
+
+ @Override
+ public void accept(@NotNull M68kVisitor visitor) {
+ visitor.visitProgramCounterIndirectWithIndexBaseDisplacementAddressingMode(this);
+ }
+
+ @Override
+ public void accept(@NotNull PsiElementVisitor visitor) {
+ if (visitor instanceof M68kVisitor) accept((M68kVisitor) visitor);
+ else super.accept(visitor);
+ }
+
+ @Override
+ @Nullable
+ public M68kIndexRegister getIndexRegister() {
+ return PsiTreeUtil.getChildOfType(this, M68kIndexRegister.class);
+ }
+
+ @Override
+ @Nullable
+ public M68kBaseDisplacement getBaseDisplacement() {
+ return PsiTreeUtil.getChildOfType(this, M68kBaseDisplacement.class);
+ }
+
+}
diff --git a/src/main/java/de/platon42/intellij/plugins/m68k/m68k.bnf b/src/main/java/de/platon42/intellij/plugins/m68k/m68k.bnf
index dc5cd8a..ab11cbf 100644
--- a/src/main/java/de/platon42/intellij/plugins/m68k/m68k.bnf
+++ b/src/main/java/de/platon42/intellij/plugins/m68k/m68k.bnf
@@ -376,10 +376,13 @@ MemoryIndirectAddressingMode ::= ROUND_L SQUARE_L (BaseDisplacement SEPARATOR)?
]
}
-MemoryIndirectPostIndexedAddressingMode ::= ROUND_L (SQUARE_L (BaseDisplacement SEPARATOR)? AddressRegister SQUARE_R SEPARATOR)? IndexRegister (SEPARATOR OuterDisplacement)? ROUND_R
+private internalMemoryIndirectPostIndexedOption1 ::= (BaseDisplacement SEPARATOR)? AddressRegister
+private internalMemoryIndirectPostIndexedOption2 ::= BaseDisplacement (SEPARATOR AddressRegister)?
+
+MemoryIndirectPostIndexedAddressingMode ::= ROUND_L (SQUARE_L (internalMemoryIndirectPostIndexedOption1|internalMemoryIndirectPostIndexedOption2) SQUARE_R SEPARATOR)? IndexRegister (SEPARATOR OuterDisplacement)? ROUND_R
{
implements = [
- "de.platon42.intellij.plugins.m68k.psi.M68kWithAddressRegisterIndirect"
+ "de.platon42.intellij.plugins.m68k.psi.M68kWithOptionalAddressRegisterIndirect"
"de.platon42.intellij.plugins.m68k.psi.M68kWithBaseDisplacement"
"de.platon42.intellij.plugins.m68k.psi.M68kWithIndexRegister"
"de.platon42.intellij.plugins.m68k.psi.M68kWithOuterDisplacement"
@@ -390,10 +393,10 @@ MemoryIndirectPostIndexedAddressingMode ::= ROUND_L (SQUARE_L (BaseDisplacement
]
}
-MemoryIndirectPreIndexedAddressingMode ::= ROUND_L SQUARE_L (BaseDisplacement SEPARATOR)? AddressRegister SEPARATOR IndexRegister SQUARE_R (SEPARATOR OuterDisplacement)? ROUND_R
+MemoryIndirectPreIndexedAddressingMode ::= ROUND_L SQUARE_L (BaseDisplacement SEPARATOR)? (AddressRegister SEPARATOR)? IndexRegister SQUARE_R (SEPARATOR OuterDisplacement)? ROUND_R
{
implements = [
- "de.platon42.intellij.plugins.m68k.psi.M68kWithAddressRegisterIndirect"
+ "de.platon42.intellij.plugins.m68k.psi.M68kWithOptionalAddressRegisterIndirect"
"de.platon42.intellij.plugins.m68k.psi.M68kWithBaseDisplacement"
"de.platon42.intellij.plugins.m68k.psi.M68kWithIndexRegister"
"de.platon42.intellij.plugins.m68k.psi.M68kWithOuterDisplacement"
diff --git a/src/main/java/de/platon42/intellij/plugins/m68k/psi/M68kAddressModeUtil.kt b/src/main/java/de/platon42/intellij/plugins/m68k/psi/M68kAddressModeUtil.kt
index 2fae054..e9bcaea 100644
--- a/src/main/java/de/platon42/intellij/plugins/m68k/psi/M68kAddressModeUtil.kt
+++ b/src/main/java/de/platon42/intellij/plugins/m68k/psi/M68kAddressModeUtil.kt
@@ -48,12 +48,6 @@ object M68kAddressModeUtil {
fun getReadWriteModifyRegisters(addressingMode: M68kAddressingMode?, rwm: Int): List> {
if (addressingMode == null) return emptyList()
return when (addressingMode) {
- is M68kImmediateData,
- is M68kSpecialRegisterDirectAddressingMode,
- is M68kProgramCounterIndirectWithDisplacementNewAddressingMode,
- is M68kProgramCounterIndirectWithDisplacementOldAddressingMode,
- is M68kAbsoluteAddressAddressingMode -> emptyList()
-
is M68kAddressRegisterIndirectPostIncAddressingMode -> listOf(Register.getRegFromName(addressingMode.addressRegister.text) to (RWM_READ_L or RWM_MODIFY_L))
is M68kAddressRegisterIndirectPreDecAddressingMode -> listOf(Register.getRegFromName(addressingMode.addressRegister.text) to (RWM_READ_L or RWM_MODIFY_L))
is M68kWithAddressRegisterIndirect -> listOf(Register.getRegFromName(addressingMode.addressRegister.text) to RWM_READ_L)
@@ -61,7 +55,7 @@ object M68kAddressModeUtil {
is M68kDataRegisterDirectAddressingMode -> listOf(Register.getRegFromName(addressingMode.dataRegister.text) to rwm)
is M68kAddressRegisterDirectAddressingMode -> listOf(Register.getRegFromName(addressingMode.addressRegister.text) to rwm)
is M68kRegisterListAddressingMode -> addressingMode.registers.map { it to rwm }
- else -> throw IllegalArgumentException("Unknown addressing mode $addressingMode")
+ else -> emptyList()
}.plus(
when (addressingMode) {
is M68kWithIndexRegister -> listOf(Register.getRegFromName(addressingMode.indexRegister.register.text) to if (addressingMode.indexRegister.isLongWidth) RWM_READ_L else RWM_READ_W)
diff --git a/src/test/java/de/platon42/intellij/plugins/m68k/parser/AddressingModesTest.kt b/src/test/java/de/platon42/intellij/plugins/m68k/parser/AddressingModesTest.kt
index 350cc69..11fec05 100644
--- a/src/test/java/de/platon42/intellij/plugins/m68k/parser/AddressingModesTest.kt
+++ b/src/test/java/de/platon42/intellij/plugins/m68k/parser/AddressingModesTest.kt
@@ -127,6 +127,11 @@ internal class AddressingModesTest : AbstractParsingTest() {
testGoodSyntax(testCase, " move.l ([1234.l,a1],a0),([-12,a0],d0.l*8)\n")
}
+ @Test
+ internal fun memory_indirect_post_indexed_without_address_register(@MyTestCase testCase: ParsingTestExtension.IParsingTestCase) {
+ testGoodSyntax(testCase, " move.l ([1234.l],a0),([-12],d0.l*8)\n")
+ }
+
@Test
internal fun memory_indirect_post_indexed_minimal(@MyTestCase testCase: ParsingTestExtension.IParsingTestCase) {
testGoodSyntax(testCase, " move.l ([a1],a0),([a0],d0)\n")
@@ -147,6 +152,16 @@ internal class AddressingModesTest : AbstractParsingTest() {
testGoodSyntax(testCase, " move.l ([1234.l,a1,a0]),([-12,a0,d0.l*8])\n")
}
+ @Test
+ internal fun memory_indirect_pre_indexed_without_address_register(@MyTestCase testCase: ParsingTestExtension.IParsingTestCase) {
+ testGoodSyntax(testCase, " move.l ([1234.l,a0*4]),([-12,d0.l*8])\n")
+ }
+
+ @Test
+ internal fun memory_indirect_pre_indexed_only_with_index(@MyTestCase testCase: ParsingTestExtension.IParsingTestCase) {
+ testGoodSyntax(testCase, " move.l ([a0*4]),([d0.l*8])\n")
+ }
+
@Test
internal fun memory_indirect_pre_indexed_minimal(@MyTestCase testCase: ParsingTestExtension.IParsingTestCase) {
testGoodSyntax(testCase, " move.l ([a1,a0]),([a0,d0])\n")
diff --git a/src/test/resources/parser/addressingmodes/memory_indirect_post_indexed_without_address_register.txt b/src/test/resources/parser/addressingmodes/memory_indirect_post_indexed_without_address_register.txt
new file mode 100644
index 0000000..0e52159
--- /dev/null
+++ b/src/test/resources/parser/addressingmodes/memory_indirect_post_indexed_without_address_register.txt
@@ -0,0 +1,45 @@
+Assembly File: a.asm
+ PsiWhiteSpace(' ')
+ M68kStatementImpl(STATEMENT)
+ M68kAsmInstructionImpl(ASM_INSTRUCTION)
+ M68kAsmOpImpl(ASM_OP)
+ PsiElement(M68kTokenType.MNEMONIC)('move')
+ M68kOperandSizeImpl(OPERAND_SIZE)
+ PsiElement(M68kTokenType.OPSIZE_L)('.l')
+ PsiWhiteSpace(' ')
+ M68kMemoryIndirectPostIndexedAddressingModeImpl(MEMORY_INDIRECT_POST_INDEXED_ADDRESSING_MODE)
+ PsiElement(M68kTokenType.ROUND_L)('(')
+ PsiElement(M68kTokenType.SQUARE_L)('[')
+ M68kBaseDisplacementImpl(BASE_DISPLACEMENT)
+ M68kLiteralExprImpl(LITERAL_EXPR)
+ PsiElement(M68kTokenType.DECIMAL)('1234')
+ M68kDataWidthImpl(DATA_WIDTH)
+ PsiElement(M68kTokenType.OPSIZE_L)('.l')
+ PsiElement(M68kTokenType.SQUARE_R)(']')
+ PsiElement(M68kTokenType.SEPARATOR)(',')
+ M68kIndexRegisterImpl(INDEX_REGISTER)
+ M68kAddressRegisterImpl(ADDRESS_REGISTER)
+ PsiElement(M68kTokenType.AREG)('a0')
+ PsiElement(M68kTokenType.ROUND_R)(')')
+ PsiElement(M68kTokenType.SEPARATOR)(',')
+ M68kMemoryIndirectPostIndexedAddressingModeImpl(MEMORY_INDIRECT_POST_INDEXED_ADDRESSING_MODE)
+ PsiElement(M68kTokenType.ROUND_L)('(')
+ PsiElement(M68kTokenType.SQUARE_L)('[')
+ M68kBaseDisplacementImpl(BASE_DISPLACEMENT)
+ M68kUnaryMinusExprImpl(UNARY_MINUS_EXPR)
+ PsiElement(M68kTokenType.OP_MINUS)('-')
+ M68kLiteralExprImpl(LITERAL_EXPR)
+ PsiElement(M68kTokenType.DECIMAL)('12')
+ PsiElement(M68kTokenType.SQUARE_R)(']')
+ PsiElement(M68kTokenType.SEPARATOR)(',')
+ M68kIndexRegisterImpl(INDEX_REGISTER)
+ M68kDataRegisterImpl(DATA_REGISTER)
+ PsiElement(M68kTokenType.DREG)('d0')
+ M68kDataWidthImpl(DATA_WIDTH)
+ PsiElement(M68kTokenType.OPSIZE_L)('.l')
+ PsiElement(M68kTokenType.OP_AR_MUL)('*')
+ M68kIndexScaleImpl(INDEX_SCALE)
+ M68kLiteralExprImpl(LITERAL_EXPR)
+ PsiElement(M68kTokenType.DECIMAL)('8')
+ PsiElement(M68kTokenType.ROUND_R)(')')
+ PsiElement(M68kTokenType.EOL)('\n')
\ No newline at end of file
diff --git a/src/test/resources/parser/addressingmodes/memory_indirect_pre_indexed_only_with_index.txt b/src/test/resources/parser/addressingmodes/memory_indirect_pre_indexed_only_with_index.txt
new file mode 100644
index 0000000..c0de1e1
--- /dev/null
+++ b/src/test/resources/parser/addressingmodes/memory_indirect_pre_indexed_only_with_index.txt
@@ -0,0 +1,37 @@
+Assembly File: a.asm
+ PsiWhiteSpace(' ')
+ M68kStatementImpl(STATEMENT)
+ M68kAsmInstructionImpl(ASM_INSTRUCTION)
+ M68kAsmOpImpl(ASM_OP)
+ PsiElement(M68kTokenType.MNEMONIC)('move')
+ M68kOperandSizeImpl(OPERAND_SIZE)
+ PsiElement(M68kTokenType.OPSIZE_L)('.l')
+ PsiWhiteSpace(' ')
+ M68kMemoryIndirectPreIndexedAddressingModeImpl(MEMORY_INDIRECT_PRE_INDEXED_ADDRESSING_MODE)
+ PsiElement(M68kTokenType.ROUND_L)('(')
+ PsiElement(M68kTokenType.SQUARE_L)('[')
+ M68kIndexRegisterImpl(INDEX_REGISTER)
+ M68kAddressRegisterImpl(ADDRESS_REGISTER)
+ PsiElement(M68kTokenType.AREG)('a0')
+ PsiElement(M68kTokenType.OP_AR_MUL)('*')
+ M68kIndexScaleImpl(INDEX_SCALE)
+ M68kLiteralExprImpl(LITERAL_EXPR)
+ PsiElement(M68kTokenType.DECIMAL)('4')
+ PsiElement(M68kTokenType.SQUARE_R)(']')
+ PsiElement(M68kTokenType.ROUND_R)(')')
+ PsiElement(M68kTokenType.SEPARATOR)(',')
+ M68kMemoryIndirectPreIndexedAddressingModeImpl(MEMORY_INDIRECT_PRE_INDEXED_ADDRESSING_MODE)
+ PsiElement(M68kTokenType.ROUND_L)('(')
+ PsiElement(M68kTokenType.SQUARE_L)('[')
+ M68kIndexRegisterImpl(INDEX_REGISTER)
+ M68kDataRegisterImpl(DATA_REGISTER)
+ PsiElement(M68kTokenType.DREG)('d0')
+ M68kDataWidthImpl(DATA_WIDTH)
+ PsiElement(M68kTokenType.OPSIZE_L)('.l')
+ PsiElement(M68kTokenType.OP_AR_MUL)('*')
+ M68kIndexScaleImpl(INDEX_SCALE)
+ M68kLiteralExprImpl(LITERAL_EXPR)
+ PsiElement(M68kTokenType.DECIMAL)('8')
+ PsiElement(M68kTokenType.SQUARE_R)(']')
+ PsiElement(M68kTokenType.ROUND_R)(')')
+ PsiElement(M68kTokenType.EOL)('\n')
\ No newline at end of file
diff --git a/src/test/resources/parser/addressingmodes/memory_indirect_pre_indexed_without_address_register.txt b/src/test/resources/parser/addressingmodes/memory_indirect_pre_indexed_without_address_register.txt
new file mode 100644
index 0000000..916aca6
--- /dev/null
+++ b/src/test/resources/parser/addressingmodes/memory_indirect_pre_indexed_without_address_register.txt
@@ -0,0 +1,49 @@
+Assembly File: a.asm
+ PsiWhiteSpace(' ')
+ M68kStatementImpl(STATEMENT)
+ M68kAsmInstructionImpl(ASM_INSTRUCTION)
+ M68kAsmOpImpl(ASM_OP)
+ PsiElement(M68kTokenType.MNEMONIC)('move')
+ M68kOperandSizeImpl(OPERAND_SIZE)
+ PsiElement(M68kTokenType.OPSIZE_L)('.l')
+ PsiWhiteSpace(' ')
+ M68kMemoryIndirectPreIndexedAddressingModeImpl(MEMORY_INDIRECT_PRE_INDEXED_ADDRESSING_MODE)
+ PsiElement(M68kTokenType.ROUND_L)('(')
+ PsiElement(M68kTokenType.SQUARE_L)('[')
+ M68kBaseDisplacementImpl(BASE_DISPLACEMENT)
+ M68kLiteralExprImpl(LITERAL_EXPR)
+ PsiElement(M68kTokenType.DECIMAL)('1234')
+ M68kDataWidthImpl(DATA_WIDTH)
+ PsiElement(M68kTokenType.OPSIZE_L)('.l')
+ PsiElement(M68kTokenType.SEPARATOR)(',')
+ M68kIndexRegisterImpl(INDEX_REGISTER)
+ M68kAddressRegisterImpl(ADDRESS_REGISTER)
+ PsiElement(M68kTokenType.AREG)('a0')
+ PsiElement(M68kTokenType.OP_AR_MUL)('*')
+ M68kIndexScaleImpl(INDEX_SCALE)
+ M68kLiteralExprImpl(LITERAL_EXPR)
+ PsiElement(M68kTokenType.DECIMAL)('4')
+ PsiElement(M68kTokenType.SQUARE_R)(']')
+ PsiElement(M68kTokenType.ROUND_R)(')')
+ PsiElement(M68kTokenType.SEPARATOR)(',')
+ M68kMemoryIndirectPreIndexedAddressingModeImpl(MEMORY_INDIRECT_PRE_INDEXED_ADDRESSING_MODE)
+ PsiElement(M68kTokenType.ROUND_L)('(')
+ PsiElement(M68kTokenType.SQUARE_L)('[')
+ M68kBaseDisplacementImpl(BASE_DISPLACEMENT)
+ M68kUnaryMinusExprImpl(UNARY_MINUS_EXPR)
+ PsiElement(M68kTokenType.OP_MINUS)('-')
+ M68kLiteralExprImpl(LITERAL_EXPR)
+ PsiElement(M68kTokenType.DECIMAL)('12')
+ PsiElement(M68kTokenType.SEPARATOR)(',')
+ M68kIndexRegisterImpl(INDEX_REGISTER)
+ M68kDataRegisterImpl(DATA_REGISTER)
+ PsiElement(M68kTokenType.DREG)('d0')
+ M68kDataWidthImpl(DATA_WIDTH)
+ PsiElement(M68kTokenType.OPSIZE_L)('.l')
+ PsiElement(M68kTokenType.OP_AR_MUL)('*')
+ M68kIndexScaleImpl(INDEX_SCALE)
+ M68kLiteralExprImpl(LITERAL_EXPR)
+ PsiElement(M68kTokenType.DECIMAL)('8')
+ PsiElement(M68kTokenType.SQUARE_R)(']')
+ PsiElement(M68kTokenType.ROUND_R)(')')
+ PsiElement(M68kTokenType.EOL)('\n')
\ No newline at end of file