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; package decoder;
import commands.Addlw; import commands.Addlw;
import commands.Andlw;
import commands.Command; import commands.Command;
public class CommandDecoder public class CommandDecoder
@@ -52,8 +53,7 @@ public class CommandDecoder
//xorwf(); //xorwf();
break; break;
case 0x3900: case 0x3900:
//andlw(); return new Andlw(input);
break;
case 0x3800: case 0x3800:
//iorlw(); //iorlw();
break; break;