Question

how can i find the square root of a number that is stored in the ax...

how can i find the square root of a number that is stored in the ax register in emu 8086 assembly

0 0
Add a comment Improve this question Transcribed image text
Answer #1

How to achieve-

  1. Move the input data in register AX. (Storing the no. in AX register)
  2. Move the data 0000 in CX and FFFF in BX
  3. Add 0002 to the contents of BX
  4. Increment the content of CX by 1
  5. Subtract the contents of AX and BX
  6. If Zero Flag(ZF) is not set go to step 3 else go to step 7
  7. Store the data from CX to offset 600
  8. Stop

Program in tabular form –

OFFSET MNEMONICS COMMENT
0400 MOV AX, [500] AX <- [500]
0404 MOV CX, 0000 CX <- 0000
0407 MOV BX, FFFF BX <- FFFF
040A ADD BX, 02 BX = BX + 02
040E INC CX C = C + 1
040F SUB AX, BX AX = AX – BX
0411 JNZ 040A JUMP to 040A if ZF = 0
0413 MOV [600], CX [600] <- CX
0417 HLT Stop

Explanation of how it is being done –

  1. M0V AX, [500] is used to move the data from offset 500 to register AX
  2. MOV CX 0000 is used to move 0000 to register CX
  3. MOV BX FFFF is used to move FFFF to register BX
  4. ADD BX, 02 is used to add BX and 02
  5. INC CX is used to increment the content of CX by 1
  6. SUB AX, BX is used to subtract contents of AX with BX
  7. JNZ 040A is used to jump to address 040A if zero flag(ZF) is 0
  8. MOV [600], CX is used to store the contents of CX to offset 600
  9. HLT is used end the program
Add a comment
Know the answer?
Add Answer to:
how can i find the square root of a number that is stored in the ax...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT