[Coco] 6809 example

Theodore Evans (Alex) alxevans at concentric.net
Sun Jan 18 15:04:32 EST 2004


On Jan 18, 2004, at 1:31 AM, Robert Gault wrote:

> Theodore (Alex) Evans wrote:
>> <snip>  >I
>> agree that this would be a poor first program (in any language).
> ><snip>
>
> Except for the random fill of the low res screen and generation of the 
> initial delta value, the code for this sort is no more difficult to 
> program in assembly than the bubble sort presented by Roger. For this 
> exercise there is no real need to program either in assembly. You can 
> take whatever is on the low res text screen as initial data and D can 
> be precalculated since the data length is fixed.
>
> Both of these sort programs are easier to program and follow for a 
> beginner than printing "Hello world" if you include the actual print 
> algorithm and don't interface with the Basic ROMs.

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.

* Hello, World
* Clear screen
	ldx #$0400
	lda #$20
clrlp:
	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
	end

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