[Coco] 6809 example

Bob Emery theother_bob at yahoo.com
Sat Jan 17 10:10:18 EST 2004


Shouldn't there be a Y=0: at the beginning of line 30? ;-)
Otherwise PASS will always max out since the flag isn't being reset.

Bob

--- Robert Gault <robert.gault at worldnet.att.net> wrote:
> Roger Taylor wrote:
> > 
> > The first ML program I ever typed in and saw run was, in fact, the 
> > bubble sort example from William Barden's 6809 Assembly Language 
> > Programming book. <snip>
> 
> > ----------
> > Roger Taylor
> > 
> > 
> 
> 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.
> 
> It is interesting that in this example, assembly code is almost as
> easy 
> to write and almost as short as Basic. That is because the tasks 
> involved are ideal for assembly code. For only slightly more complex 
> tasks, the size of the assembly code will balloon significantly vs
> Basic.
> 
> 
> -- 
> Coco mailing list
> Coco at maltedmedia.com
> http://five.pairlist.net/mailman/listinfo/coco


__________________________________________________
Do you Yahoo!?
New DSL Internet Access from SBC & Yahoo!
http://sbc.yahoo.com



More information about the Coco mailing list