From 3cfdd465163208bc7322565cd0c306933d7e73d2 Mon Sep 17 00:00:00 2001 From: Timon Date: Sun, 23 Nov 2025 12:02:28 +0100 Subject: [PATCH] Popravil ekstrakcijo bitov nixbpe --- ass2/machine.cpp | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/ass2/machine.cpp b/ass2/machine.cpp index d25238f..9a2c2e7 100644 --- a/ass2/machine.cpp +++ b/ass2/machine.cpp @@ -166,27 +166,31 @@ public: } InstructionInfo ii = it->second; + bool uspesno = false; switch (ii.format) { case 1: - execF1(opcode8, ii.mnemonic); + uspesno = execF1(opcode8, ii.mnemonic); break; case 2: { uint8_t operand = fetch(); - execF2(opcode8, operand, ii.mnemonic); + uspesno = execF2(opcode8, operand, ii.mnemonic); break; } case 3: { uint8_t b2 = fetch(); uint8_t b3 = fetch(); - execSIC_F3_F4(opcode8, b2, b3, ii.mnemonic); + uspesno = execSIC_F3_F4(opcode8, b2, b3, ii.mnemonic); break; } default: break; } + + if (uspesno) return; + else {} } @@ -201,9 +205,22 @@ public: } - - bool execSIC_F3_F4(uint8_t opcdode, uint8_t b1, uint8_t b2, string mnemonic) { + bool execSIC_F3_F4(uint8_t byte1, uint8_t byte2, uint8_t byte3, string mnemonic) { + uint8_t n = (byte1 >> 7) & 1; + uint8_t i = (byte1 >> 6) & 1; + uint8_t x = (byte2 >> 7) & 1; + uint8_t b = (byte2 >> 6) & 1; + uint8_t p = (byte2 >> 5) & 1; + uint8_t e = (byte2 >> 4) & 1; + + if (n == 0 && i == 0) { + //imamo format SIC + } else if (e == 1) { + //imamo format 4 + } else { + //imamo format 3 + } } };