a)
| AX | CF | M1 | O/P |
|---|---|---|---|
| -7 | |||
| -7 | |||
| 0 | |||
| NB | |||
| 0 |
b)
| AX | CF | M1 | O/P |
|---|---|---|---|
| 0 | |||
| 0 | |||
| 0 | |||
| NB | |||
| 0 |
c)
| AX | CF | M1 | O/P |
|---|---|---|---|
| 7 | |||
| 7 | |||
| 0 | |||
| B | |||
| 7 | |||
| 1 | |||
| 1 |
General description: if I/P <= 0
then O/P = 0
else O/P = 1
(So, if I/P = -254, then O/P = 0,
& if I/P = 32, then O/P = 1;
try it!)
instruction comment
========= =======
IN AX
I/P first integer
COPY A, AX store it in A
IN AX
I/P 2nd integer
COPY B, AX store it
in B
IN AX
I/P 3rd integer
MUL AX, B
multiply 3rd & 2nd integers
MUL AX, A
multiply product of 3rd & 2nd
by the 1st integer
OUT AX
O/P the result