Answer:
The code is given as follows:
MVI A, 0.68
MOV E,A
MVI D, 00h
LDA memory address
MOV C,A
LXI H, 0000h
DAD D
DCR C
JNZ repeat addition
MOV, A, L
MVI B, 12h ---- give b=12
ADD B
HLT
Explanation:
The steps of algorithm are as follows
Multiplication is done using addition of same value to itself m times so
for the product m*x, add 'm' to itself 'x' times.
Then add the result to 'b'
Steps are as follows
- Start
- Get the slope value 'm'
- Initialise a counter with 'x'
- Clear a register
- Add 'm' to the register
- Decrement counter 'x'
- If zero, go ahead.... if not zero repeat addition
- Add 'd' to the product.
In the code the values are assumed as m=0.68 and b=12