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;
|
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;
|
||||||
|
|||||||
Reference in New Issue
Block a user