[Coco] Errors in Leventhal's 6809 Subroutines book?

Don Barber don at dgb3.net
Fri Jan 28 20:50:07 EST 2022


Hi folks, I've been teaching myself 6809 assembly, and quickly ran 
across Leventhal's books which have been invaluable. I have the 
programming book, but have also been referencing the subroutine book 
from online copies available at:

https://colorcomputerarchive.com/repo/Documents/Books/6809%20Assembly%20Language%20Subroutines%20(Lance%20Leventhal).pdf

and

https://archive.org/details/assembly-language-subroutines-for-the-6809_Leventhal

Both appear identical.

However, I've already run across two bugs:

One is on page 72, in MPBMUL, where a BNE is executed right after a 
"LEAU -1,U". However, the LEAU does NOT set the Z flag, so the BNE is 
actually working off either the preceding INCA or the STA instructions 
(depending upon the STA's Carry result). One can test this does not work 
by trying to multiply 0x0001 times 0x08a6; the result will be an 
incorrect 0x00a6. One has to add a 'CMPU #0' after the LEAU statement to 
get the correct behavior.

The other is on page 78 in MPBDIV, where one will find a "LEAX -1,S" 
that should instead be "LEAX -1,X" as the X register is being used as a 
decrement counter. The original text will result in an infinite loop as 
the S register is not modified in this loop.

So my question is: is there an errata somewhere where known bugs are 
listed? I imagine people ran across these back in the day too. Both of 
these got me stuck for an hour or three each, though in hindsight they 
should have been obvious.


Thanks,

Don





More information about the Coco mailing list