Let's say x is a register which its value isn't known.
I have to make x=2a+3b
where a
and b
have unknown values.
I can use the 8086 asm instructions mov
, add
, sub
, neg
only.
The use of the mul
instruction isn't allowed, and also there is a limit of 4 instructions only.
Is it even possible?
The MOV instruction moves data bytes between the two specified operands. The byte specified by the second operand is copied to the location specified by the first operand. The source data byte is not affected.
The EAX, EBX, ECX, EDX, EBP, EDI, and ESI registers are all 32-bit general-purpose registers, used for temporary data storage and memory access. Some of CPU instructions modify specific registers.
Rewrite your expression:
2a + 3b = 2(a + b) + b = (a + b) + (a + b) + b
Note that you only need to compute the value of (a + b)
once.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With