From 022dd499ceefe3a2690cf24d712651973ea2eae1 Mon Sep 17 00:00:00 2001 From: Darkress <30271678+DarkressX@users.noreply.github.com> Date: Tue, 30 May 2023 01:18:51 +0200 Subject: [PATCH] Renamed setPcForGotoCall function to setPcFrom11BitLiteral --- de/darkress/pic16f84sim/Main.java | 2 +- de/darkress/pic16f84sim/commands/Call.java | 3 +-- de/darkress/pic16f84sim/commands/Goto.java | 3 +-- de/darkress/pic16f84sim/decoder/CommandDecoder.java | 3 +-- de/darkress/pic16f84sim/microcontroller/ProgramCounter.java | 2 +- 5 files changed, 5 insertions(+), 8 deletions(-) diff --git a/de/darkress/pic16f84sim/Main.java b/de/darkress/pic16f84sim/Main.java index 578b4cb..f4f1480 100644 --- a/de/darkress/pic16f84sim/Main.java +++ b/de/darkress/pic16f84sim/Main.java @@ -13,7 +13,7 @@ class Main ArrayList program = new ArrayList<>(); Memory.workingRegister = 0xAA; - int input1 = 0x2FFF; + int input1 = 0x27FF; program.add(CommandDecoder.decode(input1)); Memory.setPCLATH(0xFF); diff --git a/de/darkress/pic16f84sim/commands/Call.java b/de/darkress/pic16f84sim/commands/Call.java index 91a49c4..cd68115 100644 --- a/de/darkress/pic16f84sim/commands/Call.java +++ b/de/darkress/pic16f84sim/commands/Call.java @@ -1,6 +1,5 @@ package de.darkress.pic16f84sim.commands; -import de.darkress.pic16f84sim.microcontroller.Memory; import de.darkress.pic16f84sim.microcontroller.ProgramCounter; import de.darkress.pic16f84sim.microcontroller.Stack; @@ -17,6 +16,6 @@ public class Call extends CommandUtils implements Command public void execute() { Stack.push(ProgramCounter.getPc() + 1); - ProgramCounter.setPcForGotoCall(literal); + ProgramCounter.setPcFrom11BitLiteral(literal); } } diff --git a/de/darkress/pic16f84sim/commands/Goto.java b/de/darkress/pic16f84sim/commands/Goto.java index 7d3ffd8..23a1c1f 100644 --- a/de/darkress/pic16f84sim/commands/Goto.java +++ b/de/darkress/pic16f84sim/commands/Goto.java @@ -1,6 +1,5 @@ package de.darkress.pic16f84sim.commands; -import de.darkress.pic16f84sim.microcontroller.Memory; import de.darkress.pic16f84sim.microcontroller.ProgramCounter; public class Goto extends CommandUtils implements Command @@ -15,6 +14,6 @@ public class Goto extends CommandUtils implements Command @Override public void execute() { - ProgramCounter.setPcForGotoCall(literal); + ProgramCounter.setPcFrom11BitLiteral(literal); } } diff --git a/de/darkress/pic16f84sim/decoder/CommandDecoder.java b/de/darkress/pic16f84sim/decoder/CommandDecoder.java index c699140..9253ef9 100644 --- a/de/darkress/pic16f84sim/decoder/CommandDecoder.java +++ b/de/darkress/pic16f84sim/decoder/CommandDecoder.java @@ -100,8 +100,7 @@ public class CommandDecoder switch(input & 0x3800) { case 0x2000: - //call(); - break; + return new Call(input); case 0x2800: return new Goto(input); } diff --git a/de/darkress/pic16f84sim/microcontroller/ProgramCounter.java b/de/darkress/pic16f84sim/microcontroller/ProgramCounter.java index 8b5888d..f9bccb9 100644 --- a/de/darkress/pic16f84sim/microcontroller/ProgramCounter.java +++ b/de/darkress/pic16f84sim/microcontroller/ProgramCounter.java @@ -11,7 +11,7 @@ public class ProgramCounter return pc; } - public static void setPcForGotoCall(int data) + public static void setPcFrom11BitLiteral(int data) { int pcl = data & 0x00FF; int pch = Memory.getPCLATH();