Science, asked by sonalipatwekar1998, 4 days ago

No. 7
Divide 16 bit number stored in memory locations 22001H and 220H
by the 8 bit number stored at memory location 2202H. Store the
quotient in memory locations 2300H and 2301H and remainder in
memory locations 2302H and 2303H.​

Answers

Answered by saranyab620
0

Explanation:

Sample problem

(2200H) = 60H

(2201H) = A0H

(2202H) = l2H

Result = A060H/12H = 8E8H Quotient and 10H remainder

(2300H) = E8H

(2301H) = 08H

(2302H= 10H

(2303H) 00H

Source program

LHLD 2200H : Get the dividend

LDA 2202H : Get the divisor

MOV C, A

LXI D, 0000H : Quotient = 0

BACK: MOV A, L

SUB C : Subtract divisor

MOV L, A : Save partial result

JNC SKIP : if CY 1 jump

DCR H : Subtract borrow of previous subtraction

SKIP: INX D : Increment quotient

MOV A, H

CPI, 00 : Check if dividend < divisor

JNZ BACK : if no repeat

MOV A, L

CMP C

JNC BACK

SHLD 2302H : Store the remainder

XCHG

SHLD 2300H : Store the quotient

HLT : Terminate program execution

Similar questions