8086 program to determine modulus of first array elements corresponding to another array elements Last Updated : 02 Aug, 2018 Summarize Comments Improve Suggest changes Share Like Article Like Report 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 Comment More infoAdvertise with us Next Article Count array elements having modular inverse under given prime number P equal to itself A anamika9988 Follow Improve Article Tags : Competitive Programming system-programming microprocessor Similar Reads Minimum steps to make all the elements of the array divisible by 4 Given an array of size n, the task is to find the minimum number of steps required to make all the elements of the array divisible by 4. A step is defined as removal of any two elements from the array and adding the sum of these elements to the array. Examples: Input: array = {1, 2, 3, 1, 2, 3, 8} O 11 min read Minimize absolute difference between the smallest and largest array elements by minimum increment decrement operations Given an array arr[] consisting of N positive integers, the task is to minimize the number of operations required to minimize the absolute difference between the smallest and largest elements present in the array. In each operation, subtract 1 from an array element and increment 1 to another array e 8 min read Count array elements having modular inverse under given prime number P equal to itself Given an array arr[] of size N and a prime number P, the task is to count the elements of the array such that modulo multiplicative inverse of the element under modulo P is equal to the element itself. Examples: Input: arr[] = {1, 6, 4, 5}, P = 7Output: 2Explanation:Modular multiplicative inverse of 5 min read XOR of array elements whose modular inverse with a given number exists Given an array arr[] of length N and a positive integer M, the task is to find the Bitwise XOR of all the array elements whose modular inverse with M exists. Examples: Input: arr[] = {1, 2, 3}, M = 4Output: 2Explanation:Initialize the value xor with 0:For element indexed at 0 i.e., 1, its mod invers 7 min read Minimize length of an array consisting of difference between all possible pairs Given an array arr[] of size N, the task is to find the minimum count of elements required to be inserted into the array such that the absolute difference of all possible pairs exists in the array. Examples: Input: arr[] = { 3, 5 } Output: 3 Explanation: Inserting 2 into the array modifies arr[] to 8 min read Maximize modulus by replacing adjacent pairs with their modulus for any permutation of given Array Given an array A[] consisting of distinct elements, the task is to obtain the largest possible modulus value that remains after repeatedly replacing adjacent elements by their modulus, starting from the first element, for any possible permutations of the given array. (...(( A[1] mod A[2]) mod A[3]) 11 min read Like