[Coco] 6809 example
Roger Taylor
rtaylor at bayou.com
Sat Jan 17 14:01:01 EST 2004
At 11:27 AM 1/17/2004 -0500, you wrote:
Good example of assembly code, but the least efficient method of sorting.
Here is an equivalent version in Disk Basic for comparison.
>>>10 WIDTH32: FOR I=0TO511:POKEI+&H400,RND(0)*9+48:NEXT
>>>20 REM BUBBLE SORT
>>>30 FORX=&H400 TO &H5FE
>>>40 A=PEEK(X):B=PEEK(X+1):IF B>A THEN POKEX,B:POKEX+1,A:Y=1
>>>60 NEXT
>>>70 PASS=PASS+1
>>>80 IF Y<>0 THEN 30
>>>90 GOTO 90
>>>
>>>With this version when all action stops, hit the BREAK key and PRINT
>>>PASS. With Roger's example it will not be quite as easy to examine
>>>the pass counter.
I just copied it directly from the Barden example, but used lowercase,
etc. Also, in no way is that code an efficient sort algorithm. It's a
learning program.
----------
Roger Taylor
More information about the Coco
mailing list