[Coco] 6809 example
Roger Taylor
rtaylor at bayou.com
Sat Jan 17 23:20:53 EST 2004
At 01:50 PM 1/17/2004 -0500, you wrote:
>Note that even though the code is more complex, the speed is much much
>faster than the bubble sort. By implication this also means that if speed
>is your primary concern in picking a language, think again! The algorithm
>and quality of coding can be more important than the language.
>
>10 WIDTH32:FOR I=0TO511:POKEI+&H400,RND(0)*10+48:NEXT
>20 REM SUPER SHELL SORT
>30 D=INT(2^INT(LOG(512)/LOG(2))-1)
>40 FOR I=1 TO 512-D
>50 A=PEEK(I+&H3FF):B=PEEK(I+D+&H3FF):IFA<=B THEN 130
>60 POKE I+D+&H3FF,A
>70 IF I<=D THEN POKE I+&H3FF,B:GOTO130
>80 FOR J=I-D TO 1 STEP -D
>90 C=PEEK(J+&H3FF):IF B>=C THEN 120
>100 POKE(J+D+&H3FF),C
>110 NEXTJ
>120 POKE(J+D+&H3FF),B
>130 NEXTI
>140 D=INT(D/2):IF D>0THEN40
>150 GOTO150
That looks like more than a handful for a beginner, especially the LOG
functions. I think a Hello World to stdout would be a very good 1st example.
----------
Roger Taylor
More information about the Coco
mailing list