[Coco] Errors in Leventhal's 6809 Subroutines book?
Joel Rees
joel.rees at gmail.com
Sat Jan 29 22:21:28 EST 2022
On Sun, Jan 30, 2022 at 10:49 AM Joel Rees <joel.rees at gmail.com> wrote:
>
> On Sun, Jan 30, 2022 at 8:58 AM tim lindner <tlindner at macmess.org> wrote:
> >
> > On Fri, Jan 28, 2022 at 5:51 PM Don Barber <don at dgb3.net> wrote:
> > > However, I've already run across two bugs:
> >
> > <snip>
> >
> > It should be noted all of the programs from that book have been typed in at:
> >
> > https://github.com/jmatzen/leventhal-6809
>
> Cool. Since I'm interested, I'll check whether the bugs in question
> have been fixed.
After sidetracking on jmatzen's repository for gcc6809 and attending
some church meetings online, I finally checked, and the bugs mentioned
above are not yet fixed.
Here's the nitty-gritty:
-------- lines 95, 96 of MPBMUL.s --------
94:DECCTR:
95: LEAU -1,U ; DECREMENT BYTE COUNT
96: BNE MULLUP ; LOOP UNTIL MULTIPLICATION DONE
As Don noted, LEAU and LEAS do not set flags -- so that they can be
used in adjusting the stack(s) without interfering with the algorithm
flow.
As a simple fix, add one line:
94:DECCTR:
95: LEAU -1,U ; DECREMENT BYTE COUNT
CMPU #0
96: BNE MULLUP ; LOOP UNTIL MULTIPLICATION DONE
-------- end lines 95, 96 of MPBMUL.s --------
-------- line 162 of MPBMUL.s --------
160:SETUP:
161: LDX ,S ; GET SHIFT COUNT
162: LEAX -1,S ; DECREMENT SHIFT COUNT BY 1
163: STX ,S
164: BNE SHFTST ; CONTINUE UNLESS SHIFT COUNT EXHAUSTED
As a simple fix, add one line:
160:SETUP:
161: LDX ,S ; GET SHIFT COUNT
162: LEAX -1,X ; DECREMENT SHIFT COUNT BY 1
163: STX ,S
164: BNE SHFTST ; CONTINUE UNLESS SHIFT COUNT EXHAUSTED
Note that both LEAX and STX set the Z flag, so that is not a problem here.
-------- end line 162 of MPBMUL.s --------
> > --
> > tim lindner
> >
> > "Proper User Policy apparently means Simon Says."
>
> LOL
>
> --
> Joel Rees
>
> http://reiisi.blogspot.jp/p/novels-i-am-writing.html
--
Joel Rees
http://reiisi.blogspot.jp/p/novels-i-am-writing.html
More information about the Coco
mailing list