From d6a8e5c6de916bc8d26d7e5d4b9ab228dd097215 Mon Sep 17 00:00:00 2001 From: Binyamin Y Cohen <42520501+binyamin555@users.noreply.github.com> Date: Mon, 13 Jan 2025 17:16:00 +0200 Subject: [PATCH] Update main.cpp Update `SWP` and `SWPC` instructions so that they don't override the 3rd register. --- Astro8-Emulator/main.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Astro8-Emulator/main.cpp b/Astro8-Emulator/main.cpp index 1b3df84..4bee71a 100644 --- a/Astro8-Emulator/main.cpp +++ b/Astro8-Emulator/main.cpp @@ -1705,14 +1705,14 @@ void Update() cout << "ldw change AReg to " << AReg << endl; break; case SWP: - CReg = AReg; - AReg = BReg; - BReg = CReg; + AReg = AReg ^ BReg; + BReg = AReg ^ BReg; + AReg = AReg ^ BReg; break; case SWPC: - BReg = CReg; - CReg = AReg; - AReg = BReg; + AReg = AReg ^ CReg; + CReg = AReg ^ CReg; + AReg = AReg ^ CReg; break; case PCR: AReg = programCounter - 1;