Home » Archimedes archive » Acorn User » AU 1993-09.adf » !StarInfo_StarInfo » SharedCLib/SearchTest

SharedCLib/SearchTest

This website contains an archive of files for the Acorn Electron, BBC Micro, Acorn Archimedes, Commodore 16 and Commodore 64 computers, which Dominic Ford has rescued from his private collection of floppy disks and cassettes.

Some of these files were originally commercial releases in the 1980s and 1990s, but they are now widely available online. I assume that copyright over them is no longer being asserted. If you own the copyright and would like files to be removed, please contact me.

Tape/disk: Home » Archimedes archive » Acorn User » AU 1993-09.adf » !StarInfo_StarInfo
Filename: SharedCLib/SearchTest
Read OK:
File size: 017A bytes
Load address: 0000
Exec address: 0000
File contents
   10REM     >SearchTest (Info16)
   20REM By  DCA
   30REM For 32-bit machines
   40REM (c) BAU September 1993
   50:
   60MODE 0
   70n%=10000
   80DIM q% 4*n%,temp% 4
   90FOR i%=0 TO n%-1
  100 q%!(4*i%)=i%*10
  110NEXT
  120FOR test%=1 TO 10
  130 val%=10*(RND(n%)-1)
  140 PRINT"Searching for ";val%;" - ";
  150 SYS "SCL_bsearch",n%,q%,0,val% TO where%
  160 IF where%=0 PRINT "not found!" ELSE PRINT "matches item ";(where%-q%) DIV 4
  170NEXT
  180END

�     >SearchTest (Info16)

� By  DCA
� For 32-bit machines
(� (c) BAU September 1993
2:
<� 0
Fn%=10000
P� q% 4*n%,temp% 4
Z� i%=0 � n%-1
d q%!(4*i%)=i%*10
n�
x� test%=1 � 10
� val%=10*(�(n%)-1)
�" �"Searching for ";val%;" - ";
�+ ș "SCL_bsearch",n%,q%,0,val% � where%
�B � where%=0 � "not found!" � � "matches item ";(where%-q%) � 4
��
��
�
00000000  0d 00 0a 1e f4 20 20 20  20 20 3e 53 65 61 72 63  |.....     >Searc|
00000010  68 54 65 73 74 20 28 49  6e 66 6f 31 36 29 0d 00  |hTest (Info16)..|
00000020  14 0d f4 20 42 79 20 20  44 43 41 0d 00 1e 19 f4  |... By  DCA.....|
00000030  20 46 6f 72 20 33 32 2d  62 69 74 20 6d 61 63 68  | For 32-bit mach|
00000040  69 6e 65 73 0d 00 28 1c  f4 20 28 63 29 20 42 41  |ines..(.. (c) BA|
00000050  55 20 53 65 70 74 65 6d  62 65 72 20 31 39 39 33  |U September 1993|
00000060  0d 00 32 05 3a 0d 00 3c  07 eb 20 30 0d 00 46 0c  |..2.:..<.. 0..F.|
00000070  6e 25 3d 31 30 30 30 30  0d 00 50 15 de 20 71 25  |n%=10000..P.. q%|
00000080  20 34 2a 6e 25 2c 74 65  6d 70 25 20 34 0d 00 5a  | 4*n%,temp% 4..Z|
00000090  11 e3 20 69 25 3d 30 20  b8 20 6e 25 2d 31 0d 00  |.. i%=0 . n%-1..|
000000a0  64 14 20 71 25 21 28 34  2a 69 25 29 3d 69 25 2a  |d. q%!(4*i%)=i%*|
000000b0  31 30 0d 00 6e 05 ed 0d  00 78 12 e3 20 74 65 73  |10..n....x.. tes|
000000c0  74 25 3d 31 20 b8 20 31  30 0d 00 82 16 20 76 61  |t%=1 . 10.... va|
000000d0  6c 25 3d 31 30 2a 28 b3  28 6e 25 29 2d 31 29 0d  |l%=10*(.(n%)-1).|
000000e0  00 8c 22 20 f1 22 53 65  61 72 63 68 69 6e 67 20  |.." ."Searching |
000000f0  66 6f 72 20 22 3b 76 61  6c 25 3b 22 20 2d 20 22  |for ";val%;" - "|
00000100  3b 0d 00 96 2b 20 c8 99  20 22 53 43 4c 5f 62 73  |;...+ .. "SCL_bs|
00000110  65 61 72 63 68 22 2c 6e  25 2c 71 25 2c 30 2c 76  |earch",n%,q%,0,v|
00000120  61 6c 25 20 b8 20 77 68  65 72 65 25 0d 00 a0 42  |al% . where%...B|
00000130  20 e7 20 77 68 65 72 65  25 3d 30 20 f1 20 22 6e  | . where%=0 . "n|
00000140  6f 74 20 66 6f 75 6e 64  21 22 20 8b 20 f1 20 22  |ot found!" . . "|
00000150  6d 61 74 63 68 65 73 20  69 74 65 6d 20 22 3b 28  |matches item ";(|
00000160  77 68 65 72 65 25 2d 71  25 29 20 81 20 34 0d 00  |where%-q%) . 4..|
00000170  aa 05 ed 0d 00 b4 05 e0  0d ff                    |..........|
0000017a