Missing files and fix for optional values in Memory Indirect mode.

This commit is contained in:
Chris Hodges 2021-10-08 17:52:57 +02:00
parent 653f8dc9fc
commit 031d5ff4ab
17 changed files with 380 additions and 48 deletions

View File

@ -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.

View File

@ -60,6 +60,7 @@ patchPluginXml {
<p>I still got zero feedback and zero <a href="https://plugins.jetbrains.com/plugin/17268-mc68000-assembly-language-support/reviews">ratings</a> :-(</p>
<h4>V0.8 (unreleased)</h4>
<ul>
<li>New: Support for MC68020+ addressing modes! However, MC68020+ specific instructions have not been added yet.
<li>Enhancement: Label documentation now also works for local labels and includes end-of-line comment for label, too.
<li>Enhancement: Symbol definition documentation now also includes comments in the same way as the label documentation does.
<li>New: Macro definition / invocation documentation provider that even tries to expand macros.

View File

@ -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, "<AddressingMode>");
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;
}
/* ********************************************************** */
// !<<eof>> (MacroDefinition | statement) (<<eof>>|EOL)
static boolean line(PsiBuilder b, int l) {

View File

@ -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();
}

View File

@ -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();

View File

@ -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

View File

@ -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();
}

View File

@ -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) {

View File

@ -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);
}
}

View File

@ -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

View File

@ -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);
}
}

View File

@ -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"

View File

@ -48,12 +48,6 @@ object M68kAddressModeUtil {
fun getReadWriteModifyRegisters(addressingMode: M68kAddressingMode?, rwm: Int): List<Pair<Register, Int>> {
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)

View File

@ -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")

View File

@ -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')

View File

@ -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')

View File

@ -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')