Home » Archimedes archive » Acorn User » AU 1993-04.adf » !StarInfo/Files/IntSort

!StarInfo/Files/IntSort

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-04.adf
Filename: !StarInfo/Files/IntSort
Read OK:
File size: 026A bytes
Load address: FFFFFB44
Exec address: 696E03D0
File contents
   10REM     >IntSort (Info9)
   20REM By  Albert Hoekstra
   30REM For 32-bit machines
   40REM (c) BAU April 1993
   50:
   60CLS
   70VDU 15
   80PRINT"IntSort"'
   90INPUT"How many integers",t%
  100cmax%=300
  110DIM r%(t%),f%(cmax%)
  120@%=&20008
  130FOR n%=1 TO t%
  140 r%(n%)=RND(100)
  150NEXT
  160PRINT
  170PRINT"Input numbers:"
  180FOR n%=1 TO t%
  190 PRINT r%(n%);
  200NEXT n%
  210PRINT
  220:
  230time0=TIME
  240FOR n%=1 TO t%
  250 f%(r%(n%))+=1
  260NEXT n%
  270r%()=0
  280n%=1
  290c%=0
  300REPEAT
  310 WHILE f%(c%)>0
  320  r%(n%)=c%
  330 f%(c%)-=1
  340 n%+=1
  350 ENDWHILE
  360 c%+=1
  370UNTIL n%>t%
  380:
  390PRINT"Time taken: ";TIME-time0" csec, press a key..."
  400p=GET
  410PRINT'"Sorted numbers:"
  420FOR n%=1 TO t%
  430 PRINT r%(n%);
  440NEXT n%
  450PRINT
  460END

�     >IntSort (Info9)
� By  Albert Hoekstra
� For 32-bit machines
(� (c) BAU April 1993
2:
<�
F� 15
P�"IntSort"'
Z�"How many integers",t%
d
cmax%=300
n� r%(t%),f%(cmax%)
x
@%=&20008
�� n%=1 � t%
� r%(n%)=�(100)
��
��
��"Input numbers:"
�� n%=1 � t%
� � r%(n%);
�� n%
��
�:
�time0=�
�� n%=1 � t%
� f%(r%(n%))+=1
� n%

r%()=0
n%=1
"c%=0
,�
6 ȕ f%(c%)>0
@  r%(n%)=c%
J f%(c%)-=1
T
 n%+=1
^ �
h
 c%+=1
r� n%>t%
|:
�2�"Time taken: ";�-time0" csec, press a key..."
�p=�
��'"Sorted numbers:"
�� n%=1 � t%
� � r%(n%);
�� n%
��
��
�
00000000  0d 00 0a 1a f4 20 20 20  20 20 3e 49 6e 74 53 6f  |.....     >IntSo|
00000010  72 74 20 28 49 6e 66 6f  39 29 0d 00 14 19 f4 20  |rt (Info9)..... |
00000020  42 79 20 20 41 6c 62 65  72 74 20 48 6f 65 6b 73  |By  Albert Hoeks|
00000030  74 72 61 0d 00 1e 19 f4  20 46 6f 72 20 33 32 2d  |tra..... For 32-|
00000040  62 69 74 20 6d 61 63 68  69 6e 65 73 0d 00 28 18  |bit machines..(.|
00000050  f4 20 28 63 29 20 42 41  55 20 41 70 72 69 6c 20  |. (c) BAU April |
00000060  31 39 39 33 0d 00 32 05  3a 0d 00 3c 05 db 0d 00  |1993..2.:..<....|
00000070  46 08 ef 20 31 35 0d 00  50 0f f1 22 49 6e 74 53  |F.. 15..P.."IntS|
00000080  6f 72 74 22 27 0d 00 5a  1b e8 22 48 6f 77 20 6d  |ort"'..Z.."How m|
00000090  61 6e 79 20 69 6e 74 65  67 65 72 73 22 2c 74 25  |any integers",t%|
000000a0  0d 00 64 0d 63 6d 61 78  25 3d 33 30 30 0d 00 6e  |..d.cmax%=300..n|
000000b0  16 de 20 72 25 28 74 25  29 2c 66 25 28 63 6d 61  |.. r%(t%),f%(cma|
000000c0  78 25 29 0d 00 78 0d 40  25 3d 26 32 30 30 30 38  |x%)..x.@%=&20008|
000000d0  0d 00 82 0f e3 20 6e 25  3d 31 20 b8 20 74 25 0d  |..... n%=1 . t%.|
000000e0  00 8c 12 20 72 25 28 6e  25 29 3d b3 28 31 30 30  |... r%(n%)=.(100|
000000f0  29 0d 00 96 05 ed 0d 00  a0 05 f1 0d 00 aa 15 f1  |)...............|
00000100  22 49 6e 70 75 74 20 6e  75 6d 62 65 72 73 3a 22  |"Input numbers:"|
00000110  0d 00 b4 0f e3 20 6e 25  3d 31 20 b8 20 74 25 0d  |..... n%=1 . t%.|
00000120  00 be 0e 20 f1 20 72 25  28 6e 25 29 3b 0d 00 c8  |... . r%(n%);...|
00000130  08 ed 20 6e 25 0d 00 d2  05 f1 0d 00 dc 05 3a 0d  |.. n%.........:.|
00000140  00 e6 0b 74 69 6d 65 30  3d 91 0d 00 f0 0f e3 20  |...time0=...... |
00000150  6e 25 3d 31 20 b8 20 74  25 0d 00 fa 12 20 66 25  |n%=1 . t%.... f%|
00000160  28 72 25 28 6e 25 29 29  2b 3d 31 0d 01 04 08 ed  |(r%(n%))+=1.....|
00000170  20 6e 25 0d 01 0e 0a 72  25 28 29 3d 30 0d 01 18  | n%....r%()=0...|
00000180  08 6e 25 3d 31 0d 01 22  08 63 25 3d 30 0d 01 2c  |.n%=1..".c%=0..,|
00000190  05 f5 0d 01 36 10 20 c8  95 20 66 25 28 63 25 29  |....6. .. f%(c%)|
000001a0  3e 30 0d 01 40 0f 20 20  72 25 28 6e 25 29 3d 63  |>0..@.  r%(n%)=c|
000001b0  25 0d 01 4a 0e 20 66 25  28 63 25 29 2d 3d 31 0d  |%..J. f%(c%)-=1.|
000001c0  01 54 0a 20 6e 25 2b 3d  31 0d 01 5e 06 20 ce 0d  |.T. n%+=1..^. ..|
000001d0  01 68 0a 20 63 25 2b 3d  31 0d 01 72 0b fd 20 6e  |.h. c%+=1..r.. n|
000001e0  25 3e 74 25 0d 01 7c 05  3a 0d 01 86 32 f1 22 54  |%>t%..|.:...2."T|
000001f0  69 6d 65 20 74 61 6b 65  6e 3a 20 22 3b 91 2d 74  |ime taken: ";.-t|
00000200  69 6d 65 30 22 20 63 73  65 63 2c 20 70 72 65 73  |ime0" csec, pres|
00000210  73 20 61 20 6b 65 79 2e  2e 2e 22 0d 01 90 07 70  |s a key..."....p|
00000220  3d a5 0d 01 9a 17 f1 27  22 53 6f 72 74 65 64 20  |=......'"Sorted |
00000230  6e 75 6d 62 65 72 73 3a  22 0d 01 a4 0f e3 20 6e  |numbers:"..... n|
00000240  25 3d 31 20 b8 20 74 25  0d 01 ae 0e 20 f1 20 72  |%=1 . t%.... . r|
00000250  25 28 6e 25 29 3b 0d 01  b8 08 ed 20 6e 25 0d 01  |%(n%);..... n%..|
00000260  c2 05 f1 0d 01 cc 05 e0  0d ff                    |..........|
0000026a