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
code
8000 21 00 81 LXI H, 8100h
8003 7E MOV A, M
8004 FE 00 CPI 0
8006 C2 10 80 JNZ P2
8009 23 INX H
800A 7E MOV A, M
800B FE 00 CPI 0
800D CA 60 80 JZ P6 ; if N=0, make root=0.
8010 AF XRA A
8011 32 F1 81 STA 81F1h ; initial value=, 01
8014 32 F3 81 STA 81F3h ; for count;
8017 3C INR A ; =00 01 for
8018 32 00 82 STA 8200h ; odd number
801B 32 F0 81 STA 81F1h ; & sum of odd nos.
801E 32 F2 81 STA 81F2h
8021 21 F3 81 P3: LXI H, 81F3h
8024 3A 01 81 LDA 8101h
8027 BE CMP M
8028 DA 60 80 JC P6 ; if N<sum, make root=0.
802B C2 39 80 JNZ P5 ; if N>sum, go to take next odd no.
802E 2B P31: DCX H
802F 3A 00 81 LDA 8100h
8032 BE CMP M
8033 DA 60 80 JC P6 ; if N<sum, make root=0.
8036 CA 64 80 JZ P7 ; if N=sum, root found.
8039 3A 00 82 P5: LDA 8200h
803C 3C INR A ; increment count.
803D 27 DAA
803E 32 00 82 STA 8200h
8041 21 F0 81 LXI H, 81F0h
8044 7E MOV A, M
8045 C6 02 ADI 2
8047 27 DAA
8048 77 MOV M, A
8049 23 INX H
804A 7E MOV A, M
804B CE 00 ACI 0
804D 27 DAA
804E 77 MOV M, A
804F 2B DCX H
8050 11 F2 81 LXI D, 81F2h
8053 1A LDAX D
8054 86 ADD M
8055 27 DAA
8056 12 STAX D
8057 23 INX H
8058 13 INX D
8059 1A LDAX D
805A 8E ADC M
805B 27 DAA
805C 12 STAX D
805D C3 21 80 JMP P3
8060 AF P6: XRA A
8061 32 00 82 STA 8200h
8064 76 P7: HLT
Sample Data
Run 1 Run 2 Run 3
Input 00 25 01 69 31 22
Output 05 13 00
Memory Map
Address Run 1 Run 2 Run 3
Input 8100 25 69 22
8101 00 01 31
Output 8200 05 13 00