[Coco] 6809 example

Robert Gault robert.gault at worldnet.att.net
Sun Jan 18 16:50:01 EST 2004


Theodore (Alex) Evans wrote:

> 
><snip>
> With the shell sort you start with your initial screen, see some more or 
> less random looking swaps, then have a sorted screen.  With the bubble 
> sort you see the elements flow into position before you end up with the 
> sorted screen.
> 
> When Barden presents this he is busy introducing you to the edit and 
> assemble features of EDTASM+, it is in chapter 1 and the first opcode 
> isn't presented until chapter 3.
> 

This code look pretty good. If you are a beginner, look out world!

One thing missing is a point of origin. As written, the code will start 
at $0000 and if loaded on a Coco without an offset will crash the 
system. I suggest something like
	ORG	$7000
> * Hello, World
> * Clear screen
>     ldx #$0400
>     lda #$20

Colons are not required by EDTASM or any of the assemblers for the Coco 
that I can think of.

> clrlp:

This next line won't go anywhere because regX does not get updated. The 
routine will work as
	sta	,x+
which increments regX by one on each pass through the loop.

>     sta ,x
>     cmpx #$0600
>     blo clrlp
> * Write 'Hello, World' to middle of screen
>      ldx #$04ea
>     ldy #hello
> wrtlp:
>     lda ,y+
>     sta ,x+
>     bne wrtlp
>     rts
> hello:
>     fcc 'Hello, World'
>     fcb 0

A nice touch with EDTASM and other assemblers for the Coco is to have a 
Start address and change the next line to
	end	start
When the code is assembled, there will be a footer attached which will 
start running the code at the correct location with the commands
LOADM"HELLO":EXEC

>     end
>

Not so! First, the Step is 1 not D. Second, if a Step is 1 in Tandy 
Basic, it is not necessary to include the instruction in the FOR/NEXT 
loop. Basic will use STEP 1 automatically.

> Incidentally, on the shell sort as presented, there is an error "STEP D" 
> needs to be added to line 40.
> 
> 





More information about the Coco mailing list