![]() |
very urgent..plz help!!
could u plz suggest the 8085 assembly code for the following problem statement?
find the square roots of a few integer numbers stored in contiguous memory locations and store the results into other contiguous memory locations.(also the integer values may not be perfect squares) |
Re: very urgent..plz help!!
sorry for the belated response; but i joined this forum only today & just now saw your post.
you might have already got some program to do your required job. if not, you can modify my program (given below; it finds root of one number only) to deal with an array of numbers. Integer Square Root (Decimal) (find integer square root of given PackedBCD number; result also in PackedBCD form) Input : N : 4 digit decimal number (2 bytes PackedBCD) : starting at 8100h Output: S : square root of N : 2 digit decimal number (1 byte PackedBCD) : at 8200h (if root is not an integer, that is, if N is not a perfect square, result will be 0). Programming Notes : This program uses the fact that the sum of first N odd numbers is N2. The root is obtained by comparing successive sums of odd numbers 1,1+3,1+3+5,… from the given number, keeping a count of comparisons (that is the number of odd numbers in the sum). If we find a sum which is equal to N, the count = square root of N. If, at some stage, the sum becomes greater than N, N is not a perfect square (that is, root of N is not an integer, and the result is made 0. This circuitous method is adopted since DAA does not adjust after subtraction. Code:
Addr Machine AL Instruction Comments |
Re: very urgent..plz help!!
i see that tabs are not displayed properly. the data used for the 3 runs of the program is given here again.
Sample Data Run 1 Input 00 25 Output 05 Run 2 Input 01 69 Output 13 Run 3 input 31 22 output 00 Memory Map (how the data are located/seen in memory) Run 1 Input 25 at memory address 8100 00 at memory address 8101 Output 05 at memory address 8200 run 2 input 69 at memory address 8100 01 at memory address 8101 output 13 at memory address 8200 run 3 input 22 at memory address 8100 31 at memory address 8101 output 00 at memory address 8200 by the way, the program was written for & run/tested in commercial 8085 trainer kits Model ESA85-2 and Model MPS85-3 made by Electro System Associates, Bangalore (India). other kits may tell you to use a different memory address range. |
| All times are GMT +5.5. The time now is 02:27. |