Question

Write a subroutine code in ASSEMBLY LANGUAGE (Mano format) to divide two positive numbers by repe...

Write a subroutine code in ASSEMBLY LANGUAGE (Mano format) to divide two positive numbers by repeated subtraction method. For example, to divide 100 over 8 by subtracting 8 from 100 until the reminder be less than 8, then count the times of the subtractions, to give the result. The first number, second number, and then the result locations must follow the calling code.

PLEASE WRITE YOUR ANSWER IN ASSEMBLY LANGUAGE ONLY.

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

Here we are assuming that this code is called from location 2049.

2000 LXI H, 2050 load the HL pair
2003 MOV B, M B<-M
2004 MVI C, 00 C<-00H
2006 INX H increment
2007 MOV A, M A<-M
2008 CMP B compare
2009 JC 2011 check for carry
200C SUB B A<-A-B
200D INR C C<-C+1
200E JMP 2008 jump
2011 STA 2052 3050<-A
2014 MOV A, C A<-C
2015 STA 2053 3051<-A
2018 HLT terminate the program
Add a comment
Know the answer?
Add Answer to:
Write a subroutine code in ASSEMBLY LANGUAGE (Mano format) to divide two positive numbers by repe...
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
ADVERTISEMENT