  # tecci06

Members

16

## Community Reputation

3 Neutral

• Rank 1. Made this on the Commodore 64 with Basic-Boss Compiler V2.4 Limit 250: 0,33 seconds Limit 10000: 26,283 seconds Limit 20000: 53,7 seconds
2. had to do a change in the code for the ACORN Electron: 10CLS:CLEAR 20K%=0:I%=0:T%=0:P%=0 100PRINT"Prime Number Generator" 110INPUT"Upper Limit";N% 120ETIME=TIME 130T%=INT((N%-3)/2) 140DIMA%(T%+1) 160FORI%=0TOT%:A%(I%)=0:NEXT 200FORI%=0TOT%:IFA%(I%)THENPRINT"..";:NEXT:GOTO330 220P%=I%+I%+3:PRINT;P%;".";:K%=I%+P%:IFK%<=T%FORK%=K%TOT%STEPP%:A%(K%)=1:NEXT 260NEXT 330ETIME=(TIME-ETIME)/100 340PRINT:PRINT"Total: ";ETIME 360END Line 330: it has to divide by 100, not 60 to get the correct seconds. Did check this value by hand timing with a limit of 10000. Now the results are: Limit 250: 1,41 Limit 10000: 52,11 For the C64, the division by 60 is correct.
3. used your code from post #94 on my Commodore 64 (BASIC 2.0) Limit 250: 3,133 Limit 10000: 136,5
4. It is not required. But I did run without the THEN statement and did get: Limit 250: 2,35 --> no improvement Limit 10000: 86,63 instead of 86,83 well..... not much
5. Results on a Apple IIc 10 HOME : CLEAR 20 K = 0:I = 0:T = 0:P = 0 100 PRINT "Prime Number Generator" 110 INPUT "Upper Limit";N 130 T = INT ((N-3) / 2) 140 DIM A(T + 1) 150 FOR I = 0 TO T:A(I) = 0: NEXT 200 FOR I = 0 TO T: IF A(I) = 1 THEN PRINT "..";: NEXT: GOTO 340 210 P = I + I + 3: PRINT P;".";: K = I + P: IF K < = T THEN FOR K = K TO T STEP P:A(K) = 1: NEXT 260 NEXT 340 PRINT : PRINT "Done" 350 END With hand timing: Limit 250: ~3 seconds Limit 10000: 125 seconds
6. ACORN Electron. Now, with the new code and without the screen turned off. 10CLS:CLEAR 20K%=0:I%=0:T%=0:P%=0 100PRINT"Prime Number Generator" 110INPUT"Upper Limit";N% 120ETIME=TIME 130T%=INT((N%-3)/2) 140DIMA%(T%+1) 160FORI%=0TOT%:A%(I%)=0:NEXT 200FORI%=0TOT%:IFA%(I%)THENPRINT"..";:NEXT:GOTO330 220P%=I%+I%+3:PRINT;P%;".";:K%=I%+P%:IFK%<=T%FORK%=K%TOT%STEPP%:A%(K%)=1:NEXT 260NEXT 330ETIME=(TIME-ETIME)/60 340PRINT:PRINT"Total: ";ETIME 360END Limit 250: 2,35 Limit 10000: 86,83 It works now with the limit of 10000, because of the change of the variable A to A% etc.
7. Well, with A%(I%)=0 - only "dots" are printed. No prime numbers. If I use A%(I%)=1 see post #88. So i did leave it with IF A%(I%) THEN P%=I%+I%+3:.... I get a bit more speed after removing all spaces and disabling the screen during the output. Limit 250: 2,266 Limit 8200: 67,13 BTW: It is not a BBC Micro, it is an Arcorn Electron. From the Wiki: Clock rate: variable. CPU runs at 2 MHz when accessing ROM and 1 MHz or 0.5897 MHz when accessing RAM (depending on graphics mode) due to sharing memory access with the video display circuits. The Electron is widely misquoted as operating at 1.79 MHz after measurements derived from speed testing against the thoroughly 2 MHz BBC Micro...
8. You mean A(I)=1 not 0 With A(I)=1 it is a bit slower with 250. 3,5 instead of 3,38333 With the large limit: 111,85 instead of 107,933 These changes are more efficient on the ACORN Electron: 10 CLS: CLEAR 20 K%=0:I%=0:T%=0:P%=0 100 PRINT "Prime Number Generator" 110 INPUT "Upper Limit";N% 120 ETIME=TIME 130 T%=INT((N%-3)/2) 140 DIM A%(T%+1) 160 FOR I%=0 TO T%:A%(I%)=1:NEXT 200 FOR I%=0 TO T%:IF A%(I%) THEN P%=I%+I%+3:PRINT;P%;".";:K%=I%+P%:ELSE PRINT"..";:NEXT:GOTO 330 250 IF K%<=T% FOR K%=K% TO T% STEP P%:A%(K%)=0:NEXT 260 NEXT 330 ETIME=(TIME-ETIME)/60 340 PRINT:PRINT"Total: ";ETIME 360 END Limit 250: 2,43 Limit 8200: 74,16
9. I was curious, so I wrote the lines on my "real" ZX Spectrum+ BASIC and the Acorn Electron BBC BASIC. ZX Spectrum+ (48k) 10 CLS : CLEAR 20 LET K=0 : LET I=0 : LET T=0 : LET P=0 30 PRINT "Prime Number Generator" 40 INPUT "Upper Limit :";N 50 LET T=INT ((N-3)/2) 60 DIM A(T+1) 70 FOR I=1 TO T: LET A(I)=1: NEXT I 80 FOR I=1 TO T 90 IF A(I)=1 THEN GO TO 110 100 PRINT "..";: GO TO 140 110 LET P=I+I+3: PRINT P;".";:LET K=I+P 120 IF K>T THEN GO TO 140 130 FOR K=K TO T STEP P: LET A(K)=0: NEXT K 140 NEXT I Note: cannot assign A(0). Must start with I=1 Couldn't find a timer function. Did it manually. Limit 250: 5,5 - 5,6 Limit 10000: 262,2 (text scrolling is quite slow) ACORN Electron with BBC BASIC 2 (32K) 10 CLS: CLEAR 20 K=0:I=0:T=0:P=0 100 PRINT "Prime Number Generator" 110 INPUT "Upper Limit";N 120 ETIME=TIME 130 T=(N-3)/2 140 DIM A(T+1) 160 FOR I=0 TO T:A(I)=1:NEXT 200 FOR I=0 TO T:IF A(I) THEN P=I+I+3:PRINT;P;".";:K=I+P:ELSE PRINT"..";:NEXT:GOTO 330 250 IF K<=T FOR K=K TO T STEP P:A(K)=0:NEXT 260 NEXT 330 ETIME=(TIME-ETIME)/60 340 PRINT:PRINT"Total: ";ETIME 360 END Limit 250: 3,38333 cannot run with limit 10000. Not enough DIM space Limit 8200: 107,9333
10. @Tim: Any news regarding a RGB upgrade kit for the ATARI 7800? Can't wait to get this great RGB mod on this console. Thanks.
11. If I put the "plug in" unit in a socket, then it is to high for the original shielding. I will remove the socket and will solder the "plug in" unit directly on the board. I let you know with pictures.
12. YEEESS. That's the right jumper setting. Now, everything looks great on my 2600 junior. Perfect !! Thanks a lot. Still a question regarding the audio signal. Which is the best pin to pick it up from the board?
13. I did install the UAV Rev.D on my 2600 junior (PAL), see picture. I removed the 4050 and put in the UAV as replacement. Black wire is color. Well the picture is very good via S-Video, but very dark. It also seems the color are a bit to much. Can someone tell me, if there is something wrong with my modification? Maybe it needs other jumper settings. I just did use the jumpers configuration which are shown in post #2 for 2600. Same UAV on my Atari 7800 works perfect. Clear picture and colors are great. By the way, at what pin I should pick up the Audio signal? Appriciate any help.
×
×
• Create New...