diff --git a/8086_assembly_01/dasm.cpp b/8086_assembly_01/dasm.cpp index 34b9ff2..281e1b9 100644 --- a/8086_assembly_01/dasm.cpp +++ b/8086_assembly_01/dasm.cpp @@ -111,8 +111,10 @@ void decode_register(uint16_t instruction, bool word, char *dest) { }; // clang-format on + static const uint16_t ROW_WIDTH = 2; + uint16_t offset = instruction & reg_mask; // Multiply offset by 2 since each row has 2 columns - strcpy(dest, table[offset * 2 + (uint16_t)word]); + strcpy(dest, table[offset * ROW_WIDTH + (uint16_t)word]); }