Problem – Write 8085 program to divide two 8 bit numbers.
- Start the program by loading the HL pair registers with address of memory location.
- Move the data to B Register.
- Load the second data into accumulator.
- Compare the two numbers to check carry.
- Subtract two numbers.
- Increment the value of carry.
- Check whether the repeated subtraction is over.
- Then store the results(quotient and remainder) in given memory location.
- Terminate the program.
|2000||LXI H, 2050|
|2003||MOV B, M||B<-M|
|2004||MVI C, 00||C<-00H|
|2007||MOV A, M||A<-M|
|2009||JC 2011||check for carry|
|2014||MOV A, C||A<-C|
|2018||HLT||terminate the program|
Explanation – Registers A, H, L, C, B are used for general purpose.
- LXI H, 2050 will load the HL pair register with the address 2050 of memory location.
- MOV B, M copies the content of memory into register B.
- MVI C, 00 assign 00 to C.
- INX H increment register pair HL.
- MOV A, M copies the content of memory into accumulator.
- CMP B compares the content of accumulator and register B.
- JC 2011 jump to address 2011 if carry flag is set.
- SUB B subtract the content of accumulator with register B and store the result in accumulator.
- INR C increment the register C.
- JMP 2008 control will shift to memory address 2008.
- STA 3050 stores the remainder at memory location 3050.
- MOV A, C copies the content of register into accumulator.
- STA 3051 stores the remainder at memory location 3051.
- HLT stops executing the program and halts any further execution.
Attention reader! Don’t stop learning now. Get hold of all the important CS Theory concepts for SDE interviews with the CS Theory Course at a student-friendly price and become industry ready.
- 8085 program to divide two 16 bit numbers
- 8085 program to find maximum of two 8 bit numbers
- 8085 program to add two 8 bit numbers
- 8085 program to multiply two 8 bit numbers
- 8085 program to add two 16 bit numbers
- 8085 program to swap two 8-bit numbers
- 8085 program to subtract two 8-bit numbers with or without borrow
- 8085 program to find larger of two 8 bit numbers
- 8085 program to multiply two 8 bit numbers using logical instructions
- 8085 program to swap two 16 bit numbers using Direct addressing mode
- 8085 program to swap two 8 bit numbers using Direct addressing mode
- 8085 program to subtract two 16-bit numbers with or without borrow
- 8085 program to multiply two 16-bit numbers
- 8085 program to sum of two 8 bit numbers without carry
- 8086 program to divide a 16 bit number by an 8 bit number
- 8085 program to add three 16 bit numbers stored in registers
- 8085 program to convert an 8 bit number into Grey number
- 8085 program to find 1's and 2's complement of 8-bit number
- 8085 program to convert 8 bit BCD number into ASCII Code
- 8085 program to find 1’s and 2’s complement of 16-bit number
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.