Re: A82: multiply by 12 (and some SQRXZ stuff)


[Prev][Next][Index][Thread]

Re: A82: multiply by 12 (and some SQRXZ stuff)




At 09:23 PM 5/18/98 EDT, you wrote:
>does anyone know a fast way to multiply a number by 12?  I need it for FLine
>(that substitute for FIND_PIXEL I posted will not work).  Please help.
>Thanks
>
>~Adamman

Load the number into hl and do the following:

add hl,hl
add hl,hl
ld d,h
ld e,l
add hl,hl
add hl,de

That should do it.  It works on the principle of shifting numbers.  Nearly
any multiple of a number can be calculated fairly quickly using shifting.
Hope that helps.  Now (since I helped you out), get this SQRXZ 82 beta 2
guy off my case.  Don't worry, I'm still releasing SQRXZ 82 anyway, no
matter what everyone says.  This guy doesn't have the advantages that my
version has...except his is a working, tested port and mine isn't.

BTW, Bryan Rabeler tried SQRXZ 82 on his TI-82 ROM v16.0 and it crashed
instantly.  I seem to have another advantage, as the guy was about to lose
the program off of ticalc.org, because the program didn't work (Bryan's a
nice guy though and will leave it on...just to get to his goal of 10,000
programs).  Exact quote from Bryan after the crash:  "Should be an Alpha."


                 Thomas J. Hruska -- thruska@tir.com
Shining Light Productions -- "Meeting the needs of fellow programmers"
         http://www.geocities.com/SiliconValley/Heights/8504
                    http://shinelight.home.ml.org


Follow-Ups: References: