Playing around a bit with Turbo Assembler and Turbo Debugger, I was surprised about opcodes. More precisely, I have some assembled binary in which Turbo Debugger disassembles the word
29 C3
correctly to sub bx, ax
. However, Turbo Assembler assembles the very same instruction sub bx, ax
to the following word
2B D8
Being puzzled about that, I found this reference stating that subtraction of a register from a register may indeed begin with both 29
and 2B
. Is it indeed the case that exactly the same instruction can be expressed by different opcodes? If so, why is that? Is it for historical reasons and compatibility? The reference states different operand types for the opcodes, they just coincide for sub bx, ax
. Is this for the ability to later patch in different operands via self-modifying code or the like? Furthermore, does Turbo Assembler have a syntax construct to choose one opcode over the other?
Note: I was aware of conditional jumps like je
and jz
having the same opcode as they have the same flag-dependent behaviour and the different mnemonics are there to reflect different semantics of the same operation, but the former confuses me.