Program :
MOV A,#50H
MOV B,#2CH
DIV AB
MOV R0,A
MOV R1,B
END
Explanation :
The First instruction will copy the 50H in Accumulator. Second Instruction will copy 2CH in the Register B. Third instruction is to divide the data in Accumulator by the data in Register B. After Division Remainder is stored in B register while Quotient is saved in the Accumulator. Fourth and Fifth instructions are to move the Quotient and Remainder in the R0 and R1 register respectively.
MOV A,#50H
MOV B,#2CH
DIV AB
MOV R0,A
MOV R1,B
END
Explanation :
The First instruction will copy the 50H in Accumulator. Second Instruction will copy 2CH in the Register B. Third instruction is to divide the data in Accumulator by the data in Register B. After Division Remainder is stored in B register while Quotient is saved in the Accumulator. Fourth and Fifth instructions are to move the Quotient and Remainder in the R0 and R1 register respectively.
Before
- A
- B
- R0
- R1
- 00
- 00
- 00
- 00
After
- A
- B
- R0
- R1
- 24
- 01
- 24
- 01