diff --git a/commands/Andlw.java b/commands/Andlw.java new file mode 100644 index 0000000..8c98b6e --- /dev/null +++ b/commands/Andlw.java @@ -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; + } +} diff --git a/decoder/CommandDecoder.java b/decoder/CommandDecoder.java index 56e6e6a..e22ebe8 100644 --- a/decoder/CommandDecoder.java +++ b/decoder/CommandDecoder.java @@ -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;