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?
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.