Announcement

Collapse
No announcement yet.

How To Retrieve QUAD Return With INLINE?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Clay Clear
    replied
    OK, here's a working example, for those who might need to know how to
    do it. Thanks goes to Paul for the inspiration.

    I am not going to spell out what everything means. The important
    stuff has been annotated, everything else is my coding, and is not
    relevant.

    Code:
    $INCLUDE "pbu.inc"
    
    FUNCTION Test (BYVAL S AS STRING) PUBLIC AS QUAD
        DIM Q AS LOCAL QUAD
        $INCLUDE "push.bas"
        ! mov ax, S
        ! push ax
        ! call Siz
        ! push ss      'these lines are the important ones
        ! pop es       '-----
        ! lea di, Q    '-----
        ! db &HDF      '-----
        ! db &H3D      '-----
        $INCLUDE "pop.bas"
        FUNCTION = Q
    END FUNCTION


    ------------------

    Leave a comment:


  • Clay Clear
    replied
    Ahhhh, shucks, Paul, I guess I'm so tired that I never even
    thought of byte tweaking. And here I've done it enough times before.
    Thank you very much.


    ------------------

    Leave a comment:


  • Paul Dixon
    replied
    Clay,
    without having tested this..

    I think you need to move the address of the target variable into SI (or another suitable register) and then use !DB to assemble the istruction to pop the FPU into the QWORD pointed to by SI
    e.g.
    Code:
    !mov SI, PointerToTargetQUAD
    !DB &hDD    ;FSTP..
    !DB &h1C    ;     ..QWORD [SI]
    Paul

    ------------------

    Leave a comment:


  • Clay Clear
    started a topic How To Retrieve QUAD Return With INLINE?

    How To Retrieve QUAD Return With INLINE?

    I have a couple of PB/DOS ASM functions that return QUAD's.
    These functions are called by other functions that are also
    written in inline ASM. All of them are in UNITs. According to the
    users manual, QUAD functions return their results in the FPU stack.
    PB/DOS 3.5 ASM does not have FPU support (at least, that's what it
    appears after TRYING to compile with inline FPU code). So, how
    can the calling funcitons, using ASM, retrieve the return results
    of these QUAD functions?

    Any help VERY gratefully received.


    ------------------
Working...
X