Here it is. It should run on any QL system with at least super toolkit II.
Code: Select all
90 REMark change to ALFM to work from Q68 SRAM
100 addr=ALCHP(210)
110 FOR i=0 TO 104
120 READ d$
130 POKE_W addr+i*2,HEX(d$)
140 END FOR i
190 INPUT "number to test : ";num
195 t=DATE
200 CALL addr,num,0,0,0,0,0,0,addr+206
210 PRINT PEEK_L(addr+206);" primes in ";DATE-t;" secs"
215 GO TO 190
999 REMark Program DATA
1000 DATA "2001","5380","E288","2E00","5387","2C07","E48E","E88F","DE86","2C07"
1010 DATA "E88E","DE86","2C07","E08E","DE86","2C07","7610","E6AE","DE86","2C00"
1020 DATA "5386","9C87","9C87","9C87","CCFC","000B","EA8E","DE86","9087","7405"
1030 DATA "6172","4A47","675C","5380","3802","C8C4","D882","D882","5542","4243"
1040 DATA "2E04","5243","E28F","66FA","5343","7A03","2E05","E7A7","2C04","BE45"
1050 DATA "670A","E28F","BE86","6EF6","9C87","60F2","4A46","671E","5445","B445"
1060 DATA "6D16","BA7C","001F","6DDC","2E04","8EC5","4847","4A47","6708","5445"
1070 DATA "B445","6CF0","5380","D882","D882","5884","B284","6CB2","5442","5442"
1080 DATA "3E02","CEC7","B287","6C94","5280","2080","7000","4E75","7C03","2E02"
1090 DATA "8EC6","4847","4A47","6604","7E00","4E75","5446","3E06","CEC7","B447"
1100 DATA "6CE8","7E01","4E75","0000","0000"
The timing is done with the DATE command so it give timing results with a granularity of 1 sec. Feel free to implement your own timing routine or use a stopwatch.
The result should be 148933 primes found.
BTW the program can be run with any values but give accurate results for inputs that are equal or lower to 2031585. A design choice to make things run faster. There is just a single byte to change in order to make it work with numbers up to 16 000 000. I leave it to anyone with spare time find which byte and why it was programmed this way
Peter, if you have time, could you run the test for 2000000, 1000000, 500000, 200000 and 100000 on your Q60 so I can fill my benchmark result database with an entry for the Q60 ?