**Problem –** Write a program in 8086 microprocessor to determine modulus of corresponding 8 bit n elements of first array with 8-bit n numbers of second array, where size “n” is stored at offset 500 and the numbers of first array are stored from offset 501 and the numbers of second array are stored from offset 601 and store the result numbers into first array i.e offset 501.

**Example –**

**Algorithm –**

- Store 500 to SI and 601 to DI and Load data from offset 500 to register CL and set register CH to 00 (for count).
- Increase the value of SI by 1.
- Load first number(value) from next offset (i.e 501) to register AL.
- store 00 at register AH.
- Divide the value in register AX by value at offset DI.
- Store the result (value of register AH ) to memory offset SI.
- Increase the value of SI by 1.
- Increase the value of DI by 1.
- Loop above 6 till register CX gets 0.

**Program –**

MEMORY ADDRESS | MNEMONICS | COMMENT |
---|---|---|

400 | MOV SI, 500 | SI<-500 |

403 | MOV CL, [SI] | CL<-[SI] |

405 | MOV CH, 00 | CH<-00 |

407 | INC SI | SI<-SI+1 |

408 | MOV DI, 601 | DI<-601 |

40B | MOV AL, [SI] | AL<-[SI] |

40D | MOV AH, 00 | AH<-00 |

40F | DIV [DI] | AX=AX/[DI] |

411 | MOV [SI], AH | AH->[SI] |

413 | INC SI | SI<-SI+1 |

414 | INC DI | DI<-DI+1 |

415 | LOOP 40B | JUMP TO 40B IF CX!=0 and CX=CX-1 |

417 | HLT | end |

**Explanation –**

**MOV SI, 500:**set the value of SI to 500**MOV CL, [SI]:**load data from offset SI to register CL**MOV CH, 00:**set value of register CH to 00**INC SI:**increase value of SI by 1.**MOV DI, 600:**set the value of DI to 600.**MOV AL, [SI]:**load value from offset SI to register AL**MOV AH, 00:**set value of register AH to 00.**DIV [DI]:**Divide value of register AX by content at offset DI.**MOV [SI], AH:**store value of register AH at offset SI.**INC SI:**increase value of SI by 1.**INC DI:**increase value of DI by 1.**LOOP 408:**jump to address 408 if CX not 0 and CX=CX-1.**HLT:**stop

Attention reader! Don’t stop learning now. Get hold of all the important CS Theory concepts for SDE interviews with the CS Theory Course at a student-friendly price and become industry ready.

## Recommended Posts:

- 8086 program to determine product of corresponding elements of two array elements
- 8086 program to determine sum of corresponding elements of two arrays
- 8086 program to determine subtraction of corresponding elements of two arrays
- 8086 program to determine largest number in an array of n numbers
- 8086 program to determine squares of numbers in an array of n numbers
- 8086 program to determine cubes of numbers in an array of n numbers
- 8086 program to add the content of one segment to another segment
- 8086 program to sort an integer array in ascending order
- 8086 program to find the min value in a given array
- 8086 program to sort an integer array in descending order
- 8086 program to divide a 16 bit number by an 8 bit number
- 8086 program to subtract two 16-bit numbers with or without borrow
- 8086 program to add two 16-bit numbers with or without carry
- 8086 program to multiply two 16-bit numbers
- 8086 program to convert an 8 bit BCD number into hexadecimal number
- 8086 program to find the factorial of a number
- 8086 program to add two 8 bit BCD numbers
- 8086 program to find Square Root of a number
- 8086 program to convert binary to Grey code
- 8086 program to convert 8 bit ASCII to BCD number

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.