mirror of
https://github.com/simon987/Much-Assembly-Required.git
synced 2025-04-20 02:56:44 +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;
|
package net.simon987.server.assembly;
|
||||||
|
|
||||||
import net.simon987.server.assembly.instruction.*;
|
import net.simon987.server.assembly.instruction.*;
|
||||||
import net.simon987.server.logging.LogManager;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -107,7 +106,7 @@ public class DefaultInstructionSet implements InstructionSet {
|
|||||||
public void add(Instruction instruction) {
|
public void add(Instruction instruction) {
|
||||||
Instruction aliasedInstruction = instructionMap.get(instruction.getOpCode());
|
Instruction aliasedInstruction = instructionMap.get(instruction.getOpCode());
|
||||||
if (aliasedInstruction != null) {
|
if (aliasedInstruction != null) {
|
||||||
aliasesMap.put(instruction.getMnemonic(), aliasedInstruction);
|
aliasesMap.put(instruction.getMnemonic(), instruction);
|
||||||
} else {
|
} else {
|
||||||
instructionMap.put(instruction.getOpCode(), instruction);
|
instructionMap.put(instruction.getOpCode(), instruction);
|
||||||
}
|
}
|
||||||
|
@ -1,13 +1,11 @@
|
|||||||
package net.simon987.server.assembly.instruction;
|
package net.simon987.server.assembly.instruction;
|
||||||
|
|
||||||
import net.simon987.server.assembly.Instruction;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Alias of SHL instruction
|
* Alias of SHL instruction
|
||||||
*/
|
*/
|
||||||
public class SalInstruction extends Instruction {
|
public class SalInstruction extends ShlInstruction {
|
||||||
|
|
||||||
public SalInstruction() {
|
public SalInstruction() {
|
||||||
super("sal", ShlInstruction.OPCODE);
|
super("sal");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,10 @@ public class ShlInstruction extends Instruction {
|
|||||||
super("shl", OPCODE);
|
super("shl", OPCODE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ShlInstruction(String alias) {
|
||||||
|
super(alias, OPCODE);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Status execute(Target dst, int dstIndex, Target src, int srcIndex, Status status) {
|
public Status execute(Target dst, int dstIndex, Target src, int srcIndex, Status status) {
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user