This program uses the following instructions which I haven't used in the other ones. Use of LHLD <16bit memory> instruction to load the 16 bit number stored in two separate 8 bit memory locations to the H and L Register. SHLD <16bit memory> for storing ans. Use of DAD rp instruction to add the contents of the HL pair with the specified Register pair. Use of XCHG instruction to swap values of DE pair and HL pair. PROGRAM:

Program:

Division.
Clarify the terms Divisor, Dividend, Quotient and Remainder:
Like I explained in multiplication, division is nothing but repeated subtraction. However, the programming is handled differently. In multiplication, the loop continued n number of times (for multiplication m x n). This was done by decrementing the register holding the value n and a condition when it would become zero. (JNZ).
In division however, we need to count the number of possible subtractions/deductions that can take place and therefore we increment a register to record the quotient. And this should be in an unconditional loop(JMP), broken only when the divisor is smaller than the divident. We'll use the accumulator as the dividend which will later hold the remainder once the loop is over.
We need 3 registers in this case.
A for storing the divident, which later holds the remainder.
B for storing the divisor
C for storing the quotient
PROGRAM:

A little intro before I just type the program. What is multiplication exactly?
Repeated addition of the number.
So if I was to perform 2 x 3, I'd get the answer by adding 2 three times. 2 + 2 + 2.
Take 4 registers. Say A, B, C, D.
A (Accumulator) should store the Product.
B should store the carry, if any.
C should store the first number. (like 2)
D should store the second number. (like 3)
PROGRAM:
RST1 is a software interrupt which can be used by programmers to interrupt the program. Preferred over HLT because that requires a reset using one of the physical buttons of the kit.

This pic should help. Two loops are there in a bubble sort. One inner loop to go through the elements and push the largest number to the end (while the other numbers like bubbles float towards the top) and the Outer loop which reduce the set of numbers, removing the last largest number from the set.
Four Registers required: A is used as a temporary register while traversing the series. B is used as a temporary register to swap numbers. C is used as the iterator for the outer loop D is used as the iterator for the inner loop Program:
FOR DESCENDING ORDER, USE JNC in place of JC.

1's Compliment. 16 bit numbers. That's the main difference here. Before for 8 bit numbers, we used LDA and STA. LXI H ,2050H Loads BC pair with value 2050H H> 20H L> 50H Its similar to 2 MVI instruction ie MVI H,20H MVI L,50H which eventually implies..HL > 2050H the advantage of LXI over MVI is that LXI is 3 byte and requires 10T states.Two MVI instruction is 4Byte and require 14Tstates... INX increments (and DCX decrements) the 16 bit register pairs HL pair holds the address of the location pointed by the memory pointer M. M can be used to access the actual values of HL pair. What I understand is that it shifts the address where the register H is pointing at to the next concurrent memory space. (This way, it can be used to access concurrent data like in an array using LXI H, INX H commands.)
OUTPUT: 2500 FF 2501 FF After execution of program: 2502 00 2503 00 'Cause compliment of the hexadecimal 0 is F. 0000 (0) <==> 1111 (F) 2's Compliment. A condition comes into play in this case. In the previous case of an 8 bit number, we increment the value after complimenting it to get the 2's compliment. But for 16 bit numbers, there are two parts: LSB, MSB. First, we compliment the LSB, then add one to it. (using ADI 01 instead of INR A, so as to affect the carrys for our jump statement to work properly) ADI affects all status flags while INR affects all status flags except the carry flag. Second, if the LSB on getting incremented by 1 yields a carry, that carry should be passed on to the MSB. If no carry is generated, then MSB should not be incremented by 1.
JNC (Jump if Not Carry) label This moves program control to the location specified by the label if there is no carry, (CY = 0). I prefer to think of it this way: If there is a carry, execute the command immediately after. Similarly for JC (JUMP if CARRY) USED usually in the opposite sense. If there is NO carry, execute the command immediately after. OUTPUT: 2500 FF 2501 FF After execution of program: 2502 01 (LSB) 2503 00 (MSB) 
ALGO: 2's compliment

Since the basic idea is understood, I am now directly writing the programs now.
Finding the LARGER of the two 8 bit numbers. the CMP would perform the following: @2001  @2000 reg A  reg B So, if @2001 is greater, no carry. However, if @2001 is NOT greater, a carry/borrow is generated. So, if carry/borrow is generated, then reg B is greater, and therefore, move the value of B back to A and print or store A as the greater of the two. if carry/borrow is not generated, reg A is already the greater and is directly stored as greater of two. A condition is required to perform the underline if there is a carry/borrow. The compare instruction (CMP) in the 8085 subtracts the two operands but does not store the results. What it does do is set flags, in particular, zero, negative, carry, parity, and auxillary carry, so you can follow up the instruction with a conditional branch or call instruction to perform some operation based on the comparison of those two numbers.
To find the SMALLER of the two numbers, conveniently change the JNC to JC and reverse the meaning altogether.

ALGO TO ADD:
ALGO TO SUBTRACT:
OUTPUT: (ADD) 2000 01 2001 04 After execution of program: 2003 05 OUTPUT: (SUB) 2000 01 2001 04 After execution of program: 2003 03 Note the first number is stored at Reg B and the second one into Accumulator. Hence, when the SUB B command is executed, the first number is subtracted FROM the second number. The memory address states the location where we are entering the hexadecimal Opcode. After this, we supply the two inputs (to add) at 2000H and 2001H. (Say, 01 is entered at 2000H and maybe 04 is entered at 2001H). The location of the start of the program would be at 2500H) Execute the program at 2500H. And on execution, check the value at location 2002H. (Answer should be 05). Hexadecimal addition even allows the following: 0 B ( 0 11) 1 3 ( 1 03)
___
1 E

For eg: MOV A,B takes 1 byte (8 bits) of memory. However, LDA 2000H takes 3 bytes since the complete string takes exactly one byte (represented by an opcode later) and each 8 bit operand takes one byte. So, LDA 20 00 = 3 bytes. 