Andlw instruction (#5)
This commit is contained in:
22
commands/Andlw.java
Normal file
22
commands/Andlw.java
Normal file
@@ -0,0 +1,22 @@
|
||||
package commands;
|
||||
|
||||
import registers.Memory;
|
||||
|
||||
public class Andlw extends CommandUtils implements Command
|
||||
{
|
||||
private final int literal;
|
||||
|
||||
public Andlw(int input)
|
||||
{
|
||||
literal = input & 0x00FF;
|
||||
}
|
||||
@Override
|
||||
public void execute()
|
||||
{
|
||||
int result = literal & Memory.workingRegister;
|
||||
|
||||
checkZeroBit(result);
|
||||
|
||||
Memory.workingRegister = result % 256;
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package decoder;
|
||||
|
||||
import commands.Addlw;
|
||||
import commands.Andlw;
|
||||
import commands.Command;
|
||||
|
||||
public class CommandDecoder
|
||||
@@ -52,8 +53,7 @@ public class CommandDecoder
|
||||
//xorwf();
|
||||
break;
|
||||
case 0x3900:
|
||||
//andlw();
|
||||
break;
|
||||
return new Andlw(input);
|
||||
case 0x3800:
|
||||
//iorlw();
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user