Some useful short 6809 routines

Hardware Hacking, Programming and Game Solutions/Cheats
Post Reply
roganjosh
Posts: 10
Joined: Fri Oct 01, 2021 3:40 pm
Location: Leeds

Some useful short 6809 routines

Post by roganjosh »

Although I've programmed the Z80/6502/68000/etc a lot I'm a noob to the Dragon and the 6809. I therefore did some searching on the net to see if there were any useful maths and utility routines. The sort of routines you use regularly such as outputting hexadecimal from binary or doing a 30x30 division. I found precisely nothing, but that may be a problem with me rather than the net. Having said that, if you look hard enough, you can generally find such routines for other MPUs. Anyway, I ended up spending a couple of days writing some of the things I use frequently from scratch.
maths+utils.zip
(4.17 KiB) Downloaded 130 times
They may be of use to other Dragon/6809 noobs. They're written with relocation in mind and with extended addressing. Maybe my style will change as I get used to the new (to me) addressing modes. I also don't know whether puls pc or rts is preferred by the 6809 community so I've used a mix to make everyone or no one (un)happy.

Anyway, as I'm intending to post a few questions to this forum I thought it best to have my first non-introductory post as a contribution lest I get an initial reputation as just a leech.

Alan
sorchard
Posts: 513
Joined: Sat Jun 07, 2014 9:43 pm
Location: Norwich UK

Re: Some useful short 6809 routines

Post by sorchard »

Cool. Thanks for sharing :)

There is an old trick for converting a binary digit to ascii hex that is fewer bytes than the branching version:

Code: Select all

        adda #$90
        daa
        adca #$40
        daa
Also, I wonder how the long multiplication compares with a version that uses 6809 MUL (8x8) to generate the partial products.
Stew
roganjosh
Posts: 10
Joined: Fri Oct 01, 2021 3:40 pm
Location: Leeds

Re: Some useful short 6809 routines

Post by roganjosh »

Thanks Stew. It's so easy at the moment to slip back into a 6502 style of thinking. I remember doing a 64bit multiply on the 68000 using mulu. At some stage I may dig that method out, convert it to 6809 and possibly add it to the library.

Alan
Post Reply