I have found this line in an old 16-bit DOS application (likely to have been generated by Borland Turbo C compiler) and I want to understand the purpose of it:
mov dx, [bp+var_192]
mov ax, [bp+var_194]
add ax, 0FFFCh
adc dx, 0FFFFh ; <-- here
push dx
push ax
push ds
... ; more pushes
call SomeFunction
As far as I understand, the purpose of this "add with carry" instruction (in this particular case) is to set the carry flag to 1, but for whatever reason, it is not used. Is it a compiler optimization to set the carry flag to 1?
What I also don't understand is that dx
register is not affected by this operation under debugger (e.g.: if it's equal to zero, it stays zero). I expected dx
register to be decreased by 1 (since 0xFFFF
is equal to −1).
FFFFFFFC
is being added to the 32-bit quantitydx:ax
.4
fromdx:ax
.