Andlw instruction (#5)

This commit is contained in:
DarkressX
2023-05-23 15:00:54 +02:00
committed by GitHub
parent 47cf49abea
commit 8011c0ce40
2 changed files with 24 additions and 2 deletions

22
commands/Andlw.java Normal file
View 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;
}
}

View File

@@ -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;