Shop OBEX P1 Docs P2 Docs Learn Events
PAK-II Question — Parallax Forums

PAK-II Question

ArchiverArchiver Posts: 46,084
edited 2001-05-23 00:04 in General Discussion
Hay all,

Dose Anyone know If the PAK-II can do this math problem?

7501876 / X = Y

Where X can be anywhere from 750 to 65535
Also can anyone give me a simple source code for a bs2

Also about how long would it take to do that problem and this one? ( guess-ta-mint )

P x 3600 / M

Where both P and M are word size

thanks

TC

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2001-05-23 00:04
    Yes. Without testing it, the code would look something like this (using the
    PAK-II library that is included):

    gosub freset ' reset PAK-II (one time)
    fpx=x
    gosub floadint ' PAK2_X = stamp_x
    gosub fxtoy ' PAK2_Y=PAK2_X
    fpxhigh=$9564
    fpxlow=$F068
    gosub floadx ' PAK2_X=7501876 (this # comes from FConvert program
    included)
    gosub Fdiv ' PAK2_X=PAK2_X/PAK2_Y
    gosub FInt

    ' 24 bit integer result in fpxhigh, fpxlow or since you only need 16 bits:
    y=fpxlow

    For the second problem:
    fpx=M
    gosub FloadInt
    gousb FXtoY
    fpxhigh=$8A61
    fpxlow=0 '3600 (from FConvert)
    gosub floadx
    gosub fdiv ' X=3600/M
    gosub FXtoY
    fpx=P
    gosub floadx
    gosub fmult ' X=X*Y
    gosub FInt ' read integer result
    result=fpxlow '(16-bit result)

    The hex numbers come from the FConvert program that appears on the disk or
    you can download it from the main page of the website
    http://www.al-williams.com/awce/

    Hope that helps.

    Regards,

    Al Williams
    AWC
    * Find out how to get a FREE copy of NetPorter for a limited time:
    http://www.al-williams.com/awce/netporter.htm



    Original Message
    From: Anthony Conti [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=e_BEKucH70UJbZ3izl9jv25Qu0rlwJuHrYMKgpCbbWJ2v1flGWDvnvEsW0MekIFway0v0vt1ucM]aconti@n...[/url
    Sent: Tuesday, May 22, 2001 5:48 PM
    To: basic stamp
    Subject: [noparse][[/noparse]basicstamps] PAK-II Question


    Hay all,

    Dose Anyone know If the PAK-II can do this math problem?

    7501876 / X = Y

    Where X can be anywhere from 750 to 65535
    Also can anyone give me a simple source code for a bs2

    Also about how long would it take to do that problem and this one? (
    guess-ta-mint )

    P x 3600 / M

    Where both P and M are word size

    thanks

    TC

    Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
Sign In or Register to comment.