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 9509be3..b007419 100644 Binary files a/project.rdbg and b/project.rdbg differ