Write a program that divides two 1 bytes hex number where the dividend is stored in 4060H and divisor in 406H stored the quotient and remainder in next two consecutive memory location respectively.
Answers
Answered by
7
Program:
MOV AX , 0000H
MOV DS , AX
MOV AL , [4060H]
MOV BL , [406H]
DIV BL
MOV [406H + 1] , AL
MOV [406H + 2] , AH
HLT
Explanation:
MOV AX , 0000H ; load 0000H into AX register
MOV DS , AX ; load DS register with the value of AX register
MOV AL , [4060H] ; load AL register with the value at memory location [4060H]. In AL we have stored the dividend.
MOV BL , [406H] ; load BL register with the value at memory location [4060H]. In BL we have stored the divisor.
DIV BL ; AL ÷ BL
MOV [406H + 1] , AL ; Store quotient
MOV [406H + 2] , AH ; Store remainder
HLT ; Exit
Attachments:
Similar questions