From 347e67c3c85cb3fd48feb61fd83673fa92114ec1 Mon Sep 17 00:00:00 2001 From: DarkressX <30271678+DarkressX@users.noreply.github.com> Date: Tue, 23 May 2023 15:12:30 +0200 Subject: [PATCH] Added Iorlw Instrction (#6) --- commands/Iorlw.java | 22 ++++++++++++++++++++++ decoder/CommandDecoder.java | 4 ++-- 2 files changed, 24 insertions(+), 2 deletions(-) create mode 100644 commands/Iorlw.java diff --git a/commands/Iorlw.java b/commands/Iorlw.java new file mode 100644 index 0000000..2522319 --- /dev/null +++ b/commands/Iorlw.java @@ -0,0 +1,22 @@ +package commands; + +import registers.Memory; + +public class Iorlw extends CommandUtils implements Command +{ + private final int literal; + + public Iorlw(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 e22ebe8..f95ee74 100644 --- a/decoder/CommandDecoder.java +++ b/decoder/CommandDecoder.java @@ -3,6 +3,7 @@ package decoder; import commands.Addlw; import commands.Andlw; import commands.Command; +import commands.Iorlw; public class CommandDecoder { @@ -55,8 +56,7 @@ public class CommandDecoder case 0x3900: return new Andlw(input); case 0x3800: - //iorlw(); - break; + return new Iorlw(input); case 0x3A00: //xorlw(); break;