mirror of
https://github.com/simon987/Much-Assembly-Required.git
synced 2025-04-10 14:26:45 +00:00
slightly rework aliases to work with inheritance
This commit is contained in:
parent
439547102f
commit
a030e9fc5d
@ -1,7 +1,6 @@
|
||||
package net.simon987.server.assembly;
|
||||
|
||||
import net.simon987.server.assembly.instruction.*;
|
||||
import net.simon987.server.logging.LogManager;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
@ -107,7 +106,7 @@ public class DefaultInstructionSet implements InstructionSet {
|
||||
public void add(Instruction instruction) {
|
||||
Instruction aliasedInstruction = instructionMap.get(instruction.getOpCode());
|
||||
if (aliasedInstruction != null) {
|
||||
aliasesMap.put(instruction.getMnemonic(), aliasedInstruction);
|
||||
aliasesMap.put(instruction.getMnemonic(), instruction);
|
||||
} else {
|
||||
instructionMap.put(instruction.getOpCode(), instruction);
|
||||
}
|
||||
|
@ -1,13 +1,11 @@
|
||||
package net.simon987.server.assembly.instruction;
|
||||
|
||||
import net.simon987.server.assembly.Instruction;
|
||||
|
||||
/**
|
||||
* Alias of SHL instruction
|
||||
*/
|
||||
public class SalInstruction extends Instruction {
|
||||
public class SalInstruction extends ShlInstruction {
|
||||
|
||||
public SalInstruction() {
|
||||
super("sal", ShlInstruction.OPCODE);
|
||||
super("sal");
|
||||
}
|
||||
}
|
||||
|
@ -13,6 +13,10 @@ public class ShlInstruction extends Instruction {
|
||||
super("shl", OPCODE);
|
||||
}
|
||||
|
||||
public ShlInstruction(String alias) {
|
||||
super(alias, OPCODE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Status execute(Target dst, int dstIndex, Target src, int srcIndex, Status status) {
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user