From fec3db7b3f9c20331533c9e157a40ac864ce7be8 Mon Sep 17 00:00:00 2001 From: doyle Date: Mon, 6 Mar 2023 22:29:07 +1100 Subject: [PATCH] perfaware/part1: Fix loop increment to get listing_0038 working --- part1/sim8086.c | 6 +++--- project.rdbg | Bin 866 -> 778 bytes 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/part1/sim8086.c b/part1/sim8086.c index 639816c..3618020 100644 --- a/part1/sim8086.c +++ b/part1/sim8086.c @@ -259,9 +259,9 @@ int main(int argc, char **argv) S86_PrintLn(S86_STR8("bits 16")); S86_ASSERT(buffer.size % 2 == 0); // We expect 2 byte instructions - for (size_t buffer_index = 0; buffer_index < (buffer.size / 2); buffer_index++) { - uint8_t byte0 = (uint8_t)buffer.data[buffer_index + 0]; - uint8_t byte1 = (uint8_t)buffer.data[buffer_index + 1]; + for (size_t buffer_index = 0; buffer_index < buffer.size; buffer_index += 2) { + uint8_t byte0 = (uint8_t)buffer.data[buffer_index + 0]; + uint8_t byte1 = (uint8_t)buffer.data[buffer_index + 1]; uint16_t byte01 = (uint16_t)byte0 << 8 | (uint16_t)byte1 << 0; S86_InstructionType instruction_type = S86_InstructionType_Count; diff --git a/project.rdbg b/project.rdbg index 9509be308b8527770699090d3b768747f592b08b..b0074194522791718ea8bc756d847c5dd05e24a5 100644 GIT binary patch delta 32 mcmaFF*2OkqA0xwLK1L9Em2uVN0wxYduE`IX+$UdPngjr|F$)L) delta 66 zcmeBTd&D+jA1@;V1b}G!$^DF$T*aBW76uk(ddZ(A?%&4=5@+N7d4zFt9pfr64