mirror of
https://github.com/simon987/Much-Assembly-Required.git
synced 2025-04-10 14:26:45 +00:00
allow instructions to override the encode method
This commit is contained in:
parent
7ba46ec36e
commit
1d3d441996
@ -133,7 +133,7 @@ public abstract class Instruction {
|
||||
*
|
||||
* @param out encoded bytes will be written here
|
||||
*/
|
||||
void encode(ByteArrayOutputStream out, int currentLine) throws IllegalOperandException {
|
||||
public void encode(ByteArrayOutputStream out, int currentLine) throws IllegalOperandException {
|
||||
|
||||
if (!noOperandsValid()) {
|
||||
throw new IllegalOperandException("This instruction must have operand(s)!", currentLine);
|
||||
@ -147,7 +147,7 @@ public abstract class Instruction {
|
||||
}
|
||||
}
|
||||
|
||||
void encode(ByteArrayOutputStream out, Operand o1, Operand o2, int currentLine)
|
||||
public void encode(ByteArrayOutputStream out, Operand o1, Operand o2, int currentLine)
|
||||
throws IllegalOperandException {
|
||||
MachineCode code = new MachineCode();
|
||||
code.writeOpcode(opCode);
|
||||
@ -182,7 +182,7 @@ public abstract class Instruction {
|
||||
}
|
||||
}
|
||||
|
||||
void encode(ByteArrayOutputStream out, Operand o1, int currentLine)
|
||||
public void encode(ByteArrayOutputStream out, Operand o1, int currentLine)
|
||||
throws IllegalOperandException {
|
||||
MachineCode code = new MachineCode();
|
||||
code.writeOpcode(opCode);
|
||||
|
Loading…
x
Reference in New Issue
Block a user