Write an ALP for 8051 microcontroller to divide two numbers. Assume dividend is stored in internal memory location 40H and divisor in memory location 41H. Store the quotient and remainder of the result in memory location 42H and 43H respectively.
Step 1: Load dividend from internal memory 40h to accumulator.
Step 2: Load divisor from 41h into register B, the address of register b is F0h
Step 3: Divide A and B
Step 4: Store the quotient of result from accumulator to memory address 42h.
Step 5: Store the remainder of result from register B to memory address 43h.
Step 6: Stop
MOV A, 40h ; Copy the content of 40h into accumulator
MOV 0F0h, 41h ; Copy content of 41h into register B
DIV AB ; Divide contents of Accumulator by B register
MOV 42H, A ; Copy the quotient from accumulator to 42h
MOV 43H, 0F0h ; Copy the remainder from B register to 43h
STOP: AJMP STOP ; Stop